当前位置:首页>java>提升Java字符串编码解码性能的技巧

提升Java字符串编码解码性能的技巧

  • 2026-01-22 00:46:07
提升Java字符串编码解码性能的技巧

1

常见字符串编码

常见的字符串编码有:
  • LATIN1 只能保存ASCII字符,又称ISO-8859-1。
  • UTF-8 变长字节编码,一个字符需要使用1个、2个或者3个byte表示。由于中文通常需要3个字节表示,中文场景UTF-8编码通常需要更多的空间,替代的方案是GBK/GB2312/GB18030。
  • UTF-16 2个字节,一个字符需要使用2个byte表示,又称UCS-2 (2-byte Universal Character Set)。根据大小端的区分,UTF-16有两种形式,UTF-16BE和UTF-16LE,缺省UTF-16指UTF-16BE。Java语言中的char是UTF-16LE编码。
  • GB18030 变长字节编码,一个字符需要使用1个、2个或者3个byte表示。类似UTF8,中文只需要2个字符,表示中文更省字节大小,缺点是在国际上不通用。

为了计算方便,内存中字符串通常使用等宽字符,Java语言中char和.NET中的char都是使用UTF-16。早期Windows-NT只支持UTF-16。

2

编码转换性能

UTF-16和UTF-8之间转换比较复杂,通常性能较差。

如下是一个将UTF-16转换为UTF-8编码的实现,可以看出算法比较复杂,所以性能较差,这个操作也无法使用vector API做优化。
static int encodeUTF8(char[] utf16, int off, int len, byte[] dest, int dp) {    int sl = off + len, last_offset = sl - 1;    while (off < sl) {        char c = utf16[off++];        if (c < 0x80) {            // Have at most seven bits            dest[dp++] = (byte) c;        } else if (c < 0x800) {            // 2 dest, 11 bits            dest[dp++] = (byte) (0xc0 | (c >> 6));            dest[dp++] = (byte) (0x80 | (c & 0x3f));        } else if (c >= '\uD800' && c < '\uE000') {            int uc;            if (c < '\uDC00') {                if (off > last_offset) {                    dest[dp++] = (byte) '?';                    return dp;                }                char d = utf16[off];                if (d >= '\uDC00' && d < '\uE000') {                    uc = (c << 10) + d + 0xfca02400;                } else {                    throw new RuntimeException("encodeUTF8 error", new MalformedInputException(1));                }            } else {                uc = c;            }            dest[dp++] = (byte) (0xf0 | ((uc >> 18)));            dest[dp++] = (byte) (0x80 | ((uc >> 12) & 0x3f));            dest[dp++] = (byte) (0x80 | ((uc >> 6) & 0x3f));            dest[dp++] = (byte) (0x80 | (uc & 0x3f));            off++; // 2 utf16        } else {            // 3 dest, 16 bits            dest[dp++] = (byte) (0xe0 | ((c >> 12)));            dest[dp++] = (byte) (0x80 | ((c >> 6) & 0x3f));            dest[dp++] = (byte) (0x80 | (c & 0x3f));        }    }    return dp;}
相关代码地址[1] 。
由于Java中char是UTF-16LE编码,如果需要将char[]转换为UTF-16LE编码的byte[]时,可以使用sun.misc.Unsafe#copyMemory方法快速拷贝。比如:
static int writeUtf16LE(char[] chars, int off, int len, byte[] dest, final int dp) {    UNSAFE.copyMemory(chars            , CHAR_ARRAY_BASE_OFFSET + off * 2            , dest            , BYTE_ARRAY_BASE_OFFSET + dp            , len * 2    );    dp += len * 2;    return dp;}

3

Java String的编码

不同版本的JDK String的实现不一样,从而导致有不同的性能表现。char是UTF-16编码,但String在JDK 9之后内部可以有LATIN1编码。
3.1. JDK 6之前的String实现
static class String {    final char[] value;    final int offset;    final int count;}
在Java 6之前,String.subString方法产生的String对象和原来String对象共用一个char[] value,这会导致subString方法返回的String的char[]被引用而无法被GC回收。于是使得很多库都会针对JDK 6及以下版本避免使用subString方法。
3.2. JDK 7/8的String实现
static class String {    final char[] value;}
JDK 7之后,字符串去掉了offset和count字段,value.length就是原来的count。这避免了subString引用大char[]的问题,优化也更容易,从而JDK7/8中的String操作性能比Java 6有较大提升。
3.3. JDK 9/10/11的实现
static class String {    final byte code;    final byte[] value;    static final byte LATIN1 = 0;    static final byte UTF16  = 1;}
JDK 9之后,value类型从char[]变成byte[],增加了一个字段code,如果字符全部是ASCII字符,使用value使用LATIN编码;如果存在任何一个非ASCII字符,则用UTF16编码。这种混合编码的方式,使得英文场景占更少的内存。缺点是导致Java 9的String API性能可能不如JDK 8,特别是传入char[]构造字符串,会被做压缩为latin编码的byte[],有些场景会下降10%。

4

快速构造字符串的方法

为了实现字符串是不可变特性,构造字符串的时候,会有拷贝的过程,如果要提升构造字符串的开销,就要避免这样的拷贝。

比如如下是JDK8的String的一个构造函数的实现

public final class String {    public String(char value[]) {        this.value = Arrays.copyOf(value, value.length);    }}
JDK8中,有一个构造函数是不做拷贝的,但这个方法不是public,需要用一个技巧实现MethodHandles.Lookup & LambdaMetafactory绑定反射来调用,文章后面有介绍这个技巧的代码。
public final class String {    String(char[] value, boolean share) {        // assert share : "unshared not supported";        this.value = value;    }}
快速构造字符的方法有三种:
  1. 使用MethodHandles.Lookup & LambdaMetafactory绑定反射
  2. 使用JavaLangAccess的相关方法
  3. 使用Unsafe直接构造
这三种方法,1和2性能差不多,3比1和2略慢,但都比直接new字符串要快得多。JDK8使用JMH测试的数据如下:
Benchmark                          Mode  Cnt       Score       Error   UnitsStringCreateBenchmark.invoke      thrpt    5  784869.350 ±  1936.754  ops/msStringCreateBenchmark.langAccess  thrpt    5  784029.186 ±  2734.300  ops/msStringCreateBenchmark.unsafe      thrpt    5  761176.319 ± 11914.549  ops/msStringCreateBenchmark.newString   thrpt    5  140883.533 ±  2217.773  ops/ms
在JDK 9之后,对全部是ASCII字符的场景,直接构造能达到更好的效果。
4.1 基于MethodHandles.Lookup & LambdaMetafactory绑定反射的快速构造字符串的方法。
相关代码地址[2]。
4.1.1 JDK8快速构造字符串
public static BiFunction<char[], Boolean, String> getStringCreatorJDK8() throws Throwable {   Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, int.class);   constructor.setAccessible(true);    MethodHandles lookup = constructor.newInstance(          String.class             , -1 // Lookup.TRUSTED);    MethodHandles.Lookup caller = lookup.in(String.class);    MethodHandle handle = caller.findConstructor(                String.class, MethodType.methodType(void.class, char[].class, boolean.class));    CallSite callSite = LambdaMetafactory.metafactory(            caller            , "apply"            , MethodType.methodType(BiFunction.class)            , handle.type().generic()            , handle            , handle.type());    return (BiFunction) callSite.getTarget().invokeExact();}
    
4.1.2 JDK 11快速构造字符串的方法
public static ToIntFunction<String> getStringCode11() throws Throwable {    Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, int.class);    constructor.setAccessible(true);    MethodHandles.Lookup lookup = constructor.newInstance(            String.class            , -1 // Lookup.TRUSTED);    MethodHandles.Lookup caller = lookup.in(String.class);    MethodHandle handle = caller.findVirtual(            String.class, "coder", MethodType.methodType(byte.class));    CallSite callSite = LambdaMetafactory.metafactory(            caller            , "applyAsInt"            , MethodType.methodType(ToIntFunction.class)            , MethodType.methodType(int.class, Object.class)            , handle            , handle.type());    return (ToIntFunction<String>) callSite.getTarget().invokeExact();}
if (JDKUtils.JVM_VERSION == 11) {    Function<byte[], String> stringCreator = JDKUtils.getStringCreatorJDK11();    byte[] bytes = new byte[]{'a', 'b', 'c'};    String apply = stringCreator.apply(bytes);    assertEquals("abc", apply);}
4.1.3 JDK 17快速构造字符串的方法
在JDK 17中,MethodHandles.Lookup使用Reflection.registerFieldsToFilter对lookupClass和allowedModes做了保护,网上搜索到的通过修改allowedModes的办法是不可用的。
在JDK 17中,要通过配置JVM启动参数才能使用MethodHandlers。如下:
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
public static BiFunction<byte[], Charset, String> getStringCreatorJDK17() throws Throwable {    Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Class.class, int.class);    constructor.setAccessible(true);    MethodHandles.Lookup lookup = constructor.newInstance(           String.class            , null            , -1 // Lookup.TRUSTED);    MethodHandles.Lookup caller = lookup.in(String.class);    MethodHandle handle = caller.findStatic(            String.class, "newStringNoRepl1", MethodType.methodType(String.class, byte[].class, Charset.class));    CallSite callSite = LambdaMetafactory.metafactory(            caller            , "apply"            , MethodType.methodType(BiFunction.class)            , handle.type().generic()            , handle            , handle.type());    return (BiFunction<byte[], Charset, String>) callSite.getTarget().invokeExact();}
if (JDKUtils.JVM_VERSION == 17) {    BiFunction<byte[], Charset, String> stringCreator = JDKUtils.getStringCreatorJDK17();    byte[] bytes = new byte[]{'a', 'b', 'c'};    String apply = stringCreator.apply(bytes, StandardCharsets.US_ASCII);    assertEquals("abc", apply);}
4.2 基于JavaLangAccess快速构造
通过SharedSecrets提供的JavaLangAccess,也可以不拷贝构造字符串,但是这个比较麻烦,JDK 8/11/17的API都不一样,对一套代码兼容不同的JDK版本不方便,不建议使用。
JavaLangAccess javaLangAccess = SharedSecrets.getJavaLangAccess();javaLangAccess.newStringNoRepl(b, StandardCharsets.US_ASCII);
4.3 基于Unsafe实现快速构造字符串
public static final Unsafe UNSAFE;static {    Unsafe unsafe = null;    try {        Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");        theUnsafeField.setAccessible(true);        unsafe = (Unsafe) theUnsafeField.get(null);    } catch (Throwable ignored) {}    UNSAFE = unsafe;}////////////////////////////////////////////Object str = UNSAFE.allocateInstance(String.class);UNSAFE.putObject(str, valueOffset, chars);
注意:在JDK 9之后,实现是不同,比如:
Object str = UNSAFE.allocateInstance(String.class);UNSAFE.putByte(str, coderOffset, (byte) 0);UNSAFE.putObject(str, valueOffset, (byte[]) bytes);

4.4 快速构建字符串的技巧应用:

如下的方法格式化日期为字符串,性能就会非常好。

public String formatYYYYMMDD(Calendar calendar) throws Throwable {    int year = calendar.get(Calendar.YEAR);    int month = calendar.get(Calendar.MONTH) + 1;    int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);    byte y0 = (byte) (year / 1000 + '0');    byte y1 = (byte) ((year / 100) % 10 + '0');    byte y2 = (byte) ((year / 10) % 10 + '0');    byte y3 = (byte) (year % 10 + '0');    byte m0 = (byte) (month / 10 + '0');    byte m1 = (byte) (month % 10 + '0');    byte d0 = (byte) (dayOfMonth / 10 + '0');    byte d1 = (byte) (dayOfMonth % 10 + '0');    if (JDKUtils.JVM_VERSION >= 9) {        byte[] bytes = new byte[] {y0, y1, y2, y3, m0, m1, d0, d1};        if (JDKUtils.JVM_VERSION == 17) {            return JDKUtils.getStringCreatorJDK17().apply(bytes, StandardCharsets.US_ASCII);        }        if (JDKUtils.JVM_VERSION <= 11) {            return JDKUtils.getStringCreatorJDK11().apply(bytes);        }        return new String(bytes, StandardCharsets.US_ASCII);    }    char[] chars = new char[]{            (char) y0,             (char) y1,             (char) y2,             (char) y3,             (char) m0,            (char) m1,             (char) d0,             (char) d1    };    if (JDKUtils.JVM_VERSION == 8) {        return JDKUtils.getStringCreatorJDK8().apply(chars, true);    }    return new String(chars);}

5

快速遍历字符串的办法

无论JDK什么版本,String.charAt都是一个较大的开销,JIT的优化效果并不好,无法消除参数index范围检测的开销,不如直接操作String里面的value数组。
public final class String {    private final char value[];    public char charAt(int index) {        if ((index < 0) || (index >= value.length)) {            throw new StringIndexOutOfBoundsException(index);        }        return value[index];    }}
在JDK 9之后的版本,charAt开销更大
public final class String {    private final byte[] value;    private final byte coder;    public char charAt(int index) {        if (isLatin1()) {            return StringLatin1.charAt(value, index);        } else {            return StringUTF16.charAt(value, index);        }    }}
5.1 获取String.value的方法
获取String.value的方法有如下:
  1. 使用Field反射
  2. 使用Unsafe
Unsafe和Field反射在JDK 8 JMH的比较数据如下:
Benchmark                         Mode  Cnt        Score       Error   UnitsStringGetValueBenchmark.reflect  thrpt    5   438374.685 ±  1032.028  ops/msStringGetValueBenchmark.unsafe   thrpt    5  1302654.150 ± 59169.706  ops/ms
5.1.1 使用反射获取String.value
static Field valueField;static {    try {        valueField = String.class.getDeclaredField("value");        valueField.setAccessible(true);    } catch (NoSuchFieldException ignored) {}}////////////////////////////////////////////char[] chars = (char[]) valueField.get(str);
5.1.2 使用Unsafe获取String.value
static long valueFieldOffset;static {    try {        Field valueField = String.class.getDeclaredField("value");        valueFieldOffset = UNSAFE.objectFieldOffset(valueField);    } catch (NoSuchFieldException ignored) {}}////////////////////////////////////////////char[] chars = (char[]) UNSAFE.getObject(str, valueFieldOffset);
static long valueFieldOffset;static long coderFieldOffset;static {    try {        Field valueField = String.class.getDeclaredField("value");        valueFieldOffset = UNSAFE.objectFieldOffset(valueField);        Field coderField = String.class.getDeclaredField("coder");        coderFieldOffset = UNSAFE.objectFieldOffset(coderField);    } catch (NoSuchFieldException ignored) {}}////////////////////////////////////////////byte coder = UNSAFE.getObject(str, coderFieldOffset);byte[] bytes = (byte[]) UNSAFE.getObject(str, valueFieldOffset);

6

更快的encodeUTF8方法

当能直接获取到String.value时,就可以直接对其做encodeUTF8操作,会比String.getBytes(StandardCharsets.UTF_8)性能好很多。
6.1 JDK8高性能encodeUTF8的方法
public static int encodeUTF8(char[] src, int offset, int len, byte[] dst, int dp) {    int sl = offset + len;    int dlASCII = dp + Math.min(len, dst.length);    // ASCII only optimized loop    while (dp < dlASCII && src[offset] < '\u0080') {        dst[dp++] = (byte) src[offset++];    }    while (offset < sl) {        char c = src[offset++];        if (c < 0x80) {            // Have at most seven bits            dst[dp++] = (byte) c;        } else if (c < 0x800) {            // 2 bytes, 11 bits            dst[dp++] = (byte) (0xc0 | (c >> 6));            dst[dp++] = (byte) (0x80 | (c & 0x3f));        } else if (c >= '\uD800' && c < ('\uDFFF' + 1)) { //Character.isSurrogate(c) but 1.7            final int uc;            int ip = offset - 1;            if (c >= '\uD800' && c < ('\uDBFF' + 1)) { // Character.isHighSurrogate(c)                if (sl - ip < 2) {                    uc = -1;                } else {                    char d = src[ip + 1];                    // d >= '\uDC00' && d < ('\uDFFF' + 1)                    if (d >= '\uDC00' && d < ('\uDFFF' + 1)) { // Character.isLowSurrogate(d)                        uc = ((c << 10) + d) + (0x010000 - ('\uD800' << 10) - '\uDC00'); // Character.toCodePoint(c, d)                    } else {                        dst[dp++] = (byte) '?';                        continue;                    }                }            } else {                //                if (c >= '\uDC00' && c < ('\uDFFF' + 1)) { // Character.isLowSurrogate(c)                    dst[dp++] = (byte) '?';                    continue;                } else {                    uc = c;                }            }            if (uc < 0) {                dst[dp++] = (byte) '?';            } else {                dst[dp++] = (byte) (0xf0 | ((uc >> 18)));                dst[dp++] = (byte) (0x80 | ((uc >> 12) & 0x3f));                dst[dp++] = (byte) (0x80 | ((uc >> 6) & 0x3f));                dst[dp++] = (byte) (0x80 | (uc & 0x3f));                offset++; // 2 chars            }        } else {            // 3 bytes, 16 bits            dst[dp++] = (byte) (0xe0 | ((c >> 12)));            dst[dp++] = (byte) (0x80 | ((c >> 6) & 0x3f));            dst[dp++] = (byte) (0x80 | (c & 0x3f));        }    }    return dp;}
  • 使用encodeUTF8方法举例
char[] chars = UNSAFE.getObject(str, valueFieldOffset);// ensureCapacity(chars.length * 3)byte[] bytes = ...; // int bytesLength = IOUtils.encodeUTF8(chars, 0, chars.length, bytes, bytesOffset);
这样encodeUTF8操作,不会有多余的arrayCopy操作,性能会得到提升。
6.1.1 性能测试比较
  • 测试代码
public class EncodeUTF8Benchmark {    static String STR = "01234567890ABCDEFGHIJKLMNOPQRSTUVWZYZabcdefghijklmnopqrstuvwzyz一二三四五六七八九十";    static byte[] out;    static long valueFieldOffset;    static {        out = new byte[STR.length() * 3];        try {            Field valueField = String.class.getDeclaredField("value");            valueFieldOffset = UnsafeUtils.UNSAFE.objectFieldOffset(valueField);        } catch (NoSuchFieldException e) {            e.printStackTrace();        }    }    @Benchmark    public void unsafeEncodeUTF8() throws Exception {        char[] chars = (char[]) UnsafeUtils.UNSAFE.getObject(STR, valueFieldOffset);        int len = IOUtils.encodeUTF8(chars, 0, chars.length, out, 0);    }    @Benchmark    public void getBytesUTF8() throws Exception {        byte[] bytes = STR.getBytes(StandardCharsets.UTF_8);        System.arraycopy(bytes, 0, out, 0, bytes.length);    }    public static void main(String[] args) throws RunnerException {        Options options = new OptionsBuilder()                .include(EncodeUTF8Benchmark.class.getName())                .mode(Mode.Throughput)                .timeUnit(TimeUnit.MILLISECONDS)                .forks(1)                .build();        new Runner(options).run();    }}
  • 测试结果
EncodeUTF8Benchmark.getBytesUTF8      thrpt    5  20690.960 ± 5431.442  ops/msEncodeUTF8Benchmark.unsafeEncodeUTF8  thrpt    5  34508.606 ±   55.510  ops/ms
从结果来看,通过unsafe + 直接调用encodeUTF8方法, 编码的所需要开销是newStringUTF8的58%。
6.2 JDK9/11/17高性能encodeUTF8的方法
public static int encodeUTF8(byte[] src, int offset, int len, byte[] dst, int dp) {    int sl = offset + len;    while (offset < sl) {        byte b0 = src[offset++];        byte b1 = src[offset++];        if (b1 == 0 && b0 >= 0) {            dst[dp++] = b0;        } else {            char c = (char)(((b0 & 0xff) << 0) | ((b1 & 0xff) << 8));            if (c < 0x800) {                // 2 bytes, 11 bits                dst[dp++] = (byte) (0xc0 | (c >> 6));                dst[dp++] = (byte) (0x80 | (c & 0x3f));            } else if (c >= '\uD800' && c < ('\uDFFF' + 1)) { //Character.isSurrogate(c) but 1.7                final int uc;                int ip = offset - 1;                if (c >= '\uD800' && c < ('\uDBFF' + 1)) { // Character.isHighSurrogate(c)                    if (sl - ip < 2) {                        uc = -1;                    } else {                        b0 = src[ip + 1];                        b1 = src[ip + 2];                        char d = (char) (((b0 & 0xff) << 0) | ((b1 & 0xff) << 8));                        // d >= '\uDC00' && d < ('\uDFFF' + 1)                        if (d >= '\uDC00' && d < ('\uDFFF' + 1)) { // Character.isLowSurrogate(d)                            uc = ((c << 10) + d) + (0x010000 - ('\uD800' << 10) - '\uDC00'); // Character.toCodePoint(c, d)                        } else {                            return -1;                        }                    }                } else {                    //                    if (c >= '\uDC00' && c < ('\uDFFF' + 1)) { // Character.isLowSurrogate(c)                        return -1;                    } else {                        uc = c;                    }                }                if (uc < 0) {                    dst[dp++] = (byte) '?';                } else {                    dst[dp++] = (byte) (0xf0 | ((uc >> 18)));                    dst[dp++] = (byte) (0x80 | ((uc >> 12) & 0x3f));                    dst[dp++] = (byte) (0x80 | ((uc >> 6) & 0x3f));                    dst[dp++] = (byte) (0x80 | (uc & 0x3f));                    offset++; // 2 chars                }            } else {                // 3 bytes, 16 bits                dst[dp++] = (byte) (0xe0 | ((c >> 12)));                dst[dp++] = (byte) (0x80 | ((c >> 6) & 0x3f));                dst[dp++] = (byte) (0x80 | (c & 0x3f));            }        }    }    return dp;}
  • 使用encodeUTF8方法举例
byte coder = UNSAFE.getObject(str, coderFieldOffset);byte[] value = UNSAFE.getObject(str, coderFieldOffset);if (coder == 0) {    // ascii arraycopy} else {    // ensureCapacity(chars.length * 3)    byte[] bytes = ...; //     int bytesLength = IOUtils.encodeUTF8(value, 0, value.length, bytes, bytesOffset);}
这样encodeUTF8操作,不会有多余的arrayCopy操作,性能会得到提升。

7

重要提醒

上面这些技巧都不是给新手使用的,使用不当会容易导致BUG,如果没彻底搞懂,请不要使用!
参考链接:

[1]https://github.com/alibaba/fastjson2/blob/2.0.3/core/src/main/java/com/alibaba/fastjson2/util/IOUtils.java

[2]https://github.com/alibaba/fastjson2/blob/2.0.3/core/src/main/java/com/alibaba/fastjson2/util/JDKUtils.java


大数据学习-数学基础及应用

本课程主要介绍大数据中的数学基础:

一、向量、矩阵介绍 ;

二、向量在游戏引擎中的应用;

三、矩阵奇异值分解及其应用 

四、导数、梯度介绍 ;五、最优化方法及其应用。

点击阅读原文查看详情!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-10 01:40:54 HTTP/2.0 GET : https://f.mffb.com.cn/a/459150.html
  2. 运行时间 : 0.250118s [ 吞吐率:4.00req/s ] 内存消耗:4,790.34kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d6a61e1e8c767a2b538fb64fd23849d1
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000753s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001318s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001686s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.004809s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001430s ]
  6. SELECT * FROM `set` [ RunTime:0.004454s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001606s ]
  8. SELECT * FROM `article` WHERE `id` = 459150 LIMIT 1 [ RunTime:0.009619s ]
  9. UPDATE `article` SET `lasttime` = 1770658854 WHERE `id` = 459150 [ RunTime:0.001438s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000594s ]
  11. SELECT * FROM `article` WHERE `id` < 459150 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.004713s ]
  12. SELECT * FROM `article` WHERE `id` > 459150 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.017465s ]
  13. SELECT * FROM `article` WHERE `id` < 459150 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.069605s ]
  14. SELECT * FROM `article` WHERE `id` < 459150 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.037700s ]
  15. SELECT * FROM `article` WHERE `id` < 459150 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.008447s ]
0.253846s