proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DateParseMultiFormat.java
DateParseMultiFormat
javaTimeFormatter
class DateParseMultiFormat { static String[] inputs = { "2012-06-23 12:13:14", "2012-06-23T12:13:14", "23/06/2012 12:13:14", }; static final DateTimeFormatter formatter = new DateTimeFormatterBuilder() .appendPattern("[yyyy-MM-dd HH:mm:ss]"...
Date[] dates = new Date[inputs.length]; for (int i = 0; i < inputs.length; i++) { String input = inputs[i]; LocalDateTime ldt = LocalDateTime.parse(input, formatter); ZoneId zoneId = DateUtils.DEFAULT_ZONE_ID; ZonedDateTime zdt = ldt.atZone(zoneId); ...
458
136
594
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DateToString.java
DateToString
main
class DateToString { static final Date date = new Date(1693836447048L); @Benchmark public void dateToString(Blackhole bh) throws Throwable { bh.consume(date.toString()); } public static void main(String[] args) throws RunnerException {<FILL_FUNCTION_BODY>} }
Options options = new OptionsBuilder() .include(DateToString.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(1) .forks(1) .build(); new Runner(options).run();
100
83
183
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DecimalDToString.java
DecimalDToString
toStringCharWithInt8UTF16
class DecimalDToString { static final BigInteger unscaledVal; static int scale = 2; static BigDecimal decimal; static BiFunction<BigDecimal, Boolean, String> LAYOUT_CHARS; static { decimal = new BigDecimal("0.09313609545535894707057877894840203225612640380859375"); unscaledVal = dec...
StringBuilder result = new StringBuilder(); result.append('\u4e2d'); result.append(2048); result.append(31337); result.append(0xbeefcace); result.append(9000); result.append(4711); result.append(1337); result.append(2100); result.append(26...
656
129
785
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DecimalHugToString.java
DecimalHugToString
toStringCharWithInt8UTF16
class DecimalHugToString { static final BigInteger unscaledVal; static int scale = 2; static BigDecimal decimal; static BiFunction<BigDecimal, Boolean, String> LAYOUT_CHARS; static { decimal = new BigDecimal("37335022433733502243.55"); unscaledVal = decimal.unscaledValue(); ...
StringBuilder result = new StringBuilder(); result.append('\u4e2d'); result.append(2048); result.append(31337); result.append(0xbeefcace); result.append(9000); result.append(4711); result.append(1337); result.append(2100); result.append(26...
619
129
748
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DecimalLargeToString.java
DecimalLargeToString
toStringCharWithInt8UTF16
class DecimalLargeToString { static final BigInteger unscaledVal; static int scale = 2; static BigDecimal decimal; static BiFunction<BigDecimal, Boolean, String> LAYOUT_CHARS; static { decimal = new BigDecimal("2715737727.55"); unscaledVal = decimal.unscaledValue(); try { ...
StringBuilder result = new StringBuilder(); result.append('\u4e2d'); result.append(2048); result.append(31337); result.append(0xbeefcace); result.append(9000); result.append(4711); result.append(1337); result.append(2100); result.append(26...
608
129
737
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DecimalSmallToString.java
DecimalSmallToString
toStringCharWithInt8
class DecimalSmallToString { static final BigInteger unscaledVal; static int scale = 2; static BigDecimal decimal; static BiFunction<BigDecimal, Boolean, String> LAYOUT_CHARS; static { decimal = new BigDecimal("415246.55"); unscaledVal = decimal.unscaledValue(); try { ...
StringBuilder result = new StringBuilder(); result.append(2048); result.append(31337); result.append(0xbeefcace); result.append(9000); result.append(4711); result.append(1337); result.append(2100); result.append(2600); bh.consume(result.to...
623
116
739
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DecimalToString.java
DecimalToString
toStringCharWithInt8UTF16
class DecimalToString { static final long unscaledVal = 123456; static int scale = 2; static BigDecimal decimal = BigDecimal.valueOf(unscaledVal, scale); static BiFunction<BigDecimal, Boolean, String> LAYOUT_CHARS; static { try { MethodHandles.Lookup lookup = JDKUtils.trustedLoo...
StringBuilder result = new StringBuilder(); result.append('\u4e2d'); result.append(2048); result.append(31337); result.append(0xbeefcace); result.append(9000); result.append(4711); result.append(1337); result.append(2100); result.append(26...
585
129
714
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DoubleToBigDecimal.java
DoubleToBigDecimal
main
class DoubleToBigDecimal { static final double value = 0.6730586701548151D; @Benchmark public void fastjson2(Blackhole bh) { bh.consume(TypeUtils.toBigDecimal(value)); } @Benchmark public void jdk(Blackhole bh) { bh.consume(BigDecimal.valueOf(value)); } public static v...
Options options = new OptionsBuilder() .include(DoubleToBigDecimal.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(1) .forks(1) .build(); new Runner(options).run();...
148
86
234
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/DoubleToString.java
DoubleToString
ryu
class DoubleToString { static double d = 0.6730586701548151D; static float f = 0.98163563F; @Benchmark public void jdk(Blackhole bh) throws Throwable { bh.consume(Double.toString(d)); } @Benchmark public void ryu(Blackhole bh) throws Throwable {<FILL_FUNCTION_BODY>} // @Benchma...
byte[] bytes = new byte[24]; int size = DoubleToDecimal.toString(d, bytes, 0, true); String str = new String(bytes, 0, 0, size); bh.consume(str);
363
64
427
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/FloatToBigDecimal.java
FloatToBigDecimal
main
class FloatToBigDecimal { static final float value = 123456.780F; @Benchmark public void fastjson2(Blackhole bh) { bh.consume(TypeUtils.toBigDecimal(value)); } @Benchmark public void jdk(Blackhole bh) { bh.consume(BigDecimal.valueOf(value)); } public static void main(S...
Options options = new OptionsBuilder() .include(FloatToBigDecimal.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(1) .forks(1) .build(); new Runner(options).run(); ...
141
86
227
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/Invoke.java
Bean
main
class Bean { private int id; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { ...
Options options = new OptionsBuilder() .include(Invoke.class.getName()) .include(InvokeFirst.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(1) .forks(1) .b...
128
96
224
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/InvokeFirst.java
InvokeFirst
genLambda
class InvokeFirst { @Benchmark public void genLambda(Blackhole bh) throws Throwable {<FILL_FUNCTION_BODY>} @Benchmark public void genLambdaASM(Blackhole bh) throws Throwable { ObjIntConsumer<Bean> function = LambdaGenerator.createSetterInt(Bean.class, "setId"); Bean bean = new Bean(); ...
MethodHandles.Lookup lookup = JDKUtils.trustedLookup(Bean.class); MethodType invokedType = MethodType.methodType(ObjIntConsumer.class); MethodHandle target = lookup.findVirtual(Bean.class, "setId", MethodType.methodType(void.class, int.class)); MethodType instantiatedMethodType = Method...
419
238
657
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/LocalDateTimeFormat19.java
LocalDateTimeFormat19
formatYMDHMS19
class LocalDateTimeFormat19 { static final String pattern = "yyyy-MM-dd HH:mm:ss"; static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); static LocalDateTime ldt = LocalDateTime.of(2023, 8, 16, 20, 21, 15); @Benchmark public void javaTimeFormatter(Blackhole bh) throws Throwable...
int year = ldt.getYear(); int month = ldt.getMonthValue(); int dayOfMonth = ldt.getDayOfMonth(); int hour = ldt.getHour(); int minute = ldt.getMinute(); int second = ldt.getSecond(); byte[] bytes = new byte[19]; int y01 = year / 100; int y23 = ye...
987
452
1,439
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/SimpleDateFormatX.java
SimpleDateFormatX
parse
class SimpleDateFormatX extends SimpleDateFormat { transient boolean format19; transient boolean format10; public SimpleDateFormatX(String pattern) { super(pattern); switch (pattern) { case "yyyy-MM-dd HH:mm:ss": format19 = true; break; ...
if (text != null) { final int textLength = text.length(); if ((format10 && textLength == 10) || (format19 && textLength == 19)) { char c0 = text.charAt(0); char c1 = text.charAt(1); char c2 = text.charAt(2); char c3 = text....
564
1,303
1,867
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.String, java.util.Locale) ,public void <init>(java.lang.String, java.text.DateFormatSymbols) ,public void applyLocalizedPattern(java.lang.String) ,public void applyPattern(java.lang.String) ,public java.lang.Object clone()...
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/StringFormatBenchmark.java
StringFormatBenchmark
main
class StringFormatBenchmark { static int value = 10245; static final String PREFIX = "id : "; static final char[] PREFIX_CHARS = PREFIX.toCharArray(); static final byte[] PREFIX_BYTES = PREFIX.getBytes(); @Benchmark public void format(Blackhole bh) throws Exception { bh.consume( ...
Options options = new OptionsBuilder() .include(StringFormatBenchmark.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(1) .forks(1) .build(); new Runner(options).run...
505
86
591
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/fastcode/UUIDUtilsBenchmark.java
UUIDUtilsBenchmark
main
class UUIDUtilsBenchmark { public static UUID uuid = UUID.randomUUID(); @Benchmark public void jdk(Blackhole bh) { bh.consume(uuid.toString()); } @Benchmark public void fj2(Blackhole bh) { bh.consume(UUIDUtils.fastUUID(uuid)); } @Benchmark public void fj2utf16(Blac...
Options options = new OptionsBuilder() .include(UUIDUtilsBenchmark.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .threads(1) .build(); ...
171
94
265
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/geoip/GeoIPParseString.java
GeoIPParseString
main
class GeoIPParseString { static String str; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static { try { InputStream is = GeoIPParseString.class.getClassLoader().getResourceAsStream("data/geoip.json"); str = IOUtils.toString(...
Options options = new OptionsBuilder() .include(GeoIPParseString.class.getName()) .exclude(EishayParseStringPretty.class.getName()) .exclude(EishayParseStringNoneCache.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILL...
420
131
551
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/geoip/GeoIPWriteString.java
GeoIPWriteString
main
class GeoIPWriteString { static GeoIP object; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static { try { InputStream is = GeoIPWriteString.class.getClassLoader().getResourceAsStream("data/geoip.json"); String str = IOUtils....
Options options = new OptionsBuilder() .include(GeoIPWriteString.class.getName()) .mode(Mode.Throughput) .warmupIterations(3) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .threads(...
407
106
513
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/issues/Issue206ParseTreeStringPretty.java
Issue206ParseTreeStringPretty
fastjson1_perf
class Issue206ParseTreeStringPretty { static String str; static ObjectMapper mapper = new ObjectMapper(); static { try { InputStream is = Issue206ParseTreeStringPretty.class.getClassLoader().getResourceAsStream("issue/issue206.json"); str = IOUtils.toString(is, "UTF-8"); ...
long start = System.currentTimeMillis(); for (int i = 0; i < 1000 * 1000; ++i) { com.alibaba.fastjson.JSON.parseObject(str); } long millis = System.currentTimeMillis() - start; System.out.println("millis : " + millis); // zulu17.32.13 : // zulu11.52.1...
657
141
798
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/Clients.java
Client
fromNumber
class Client { private long id; private int index; private UUID guid; @JSONField(name = "isActive") private boolean isActive; private BigDecimal balance; private String picture; private int age; private EyeColor eyeColor; private String nam...
if (i == 0) { return BROWN; } if (i == 1) { return BLUE; } return GREEN;
1,100
46
1,146
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8Bytes.java
ClientsParseUTF8Bytes
gson
class ClientsParseUTF8Bytes { static byte[] utf8Bytes; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader()); static { try { InputStream is = ...
bh.consume(gson .fromJson( new String(utf8Bytes, 0, utf8Bytes.length, StandardCharsets.UTF_8), Clients.class) );
496
56
552
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8Bytes.java
ClientsWriteUTF8Bytes
main
class ClientsWriteUTF8Bytes { static Clients clients; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader()); static final ThreadLocal<ByteArrayOutputStream> bytes...
Options options = new OptionsBuilder() .include(ClientsWriteUTF8Bytes.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(2) .threads(16) .build(); ...
598
97
695
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/JJBBenchmark.java
JJBBenchmark
main
class JJBBenchmark { public static void main(String[] args) throws RunnerException {<FILL_FUNCTION_BODY>} }
Options options = new OptionsBuilder() .include(UsersWriteUTF8Bytes.class.getName()) .include(UsersParseUTF8Bytes.class.getName()) .include(ClientsWriteUTF8Bytes.class.getName()) .include(ClientsParseUTF8Bytes.class.getName()) .mod...
39
144
183
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/UsersParseUTF8Bytes.java
UsersParseUTF8Bytes
gson
class UsersParseUTF8Bytes { static byte[] utf8Bytes; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader()); static { try { InputStream is = Us...
bh.consume(gson .fromJson( new String(utf8Bytes, 0, utf8Bytes.length, StandardCharsets.UTF_8), Users.class) );
542
54
596
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/UsersWriteUTF8Bytes.java
UsersWriteUTF8Bytes
main
class UsersWriteUTF8Bytes { static Users users; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader()); static final ThreadLocal<ByteArrayOutputStream> bytesOutLoc...
Options options = new OptionsBuilder() .include(UsersWriteUTF8Bytes.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(2) .threads(16) .build(); ...
590
95
685
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jsonpath/BookStore.java
BookStore
main
class BookStore { private static String str; static { try { InputStream is = BookStore.class.getClassLoader().getResourceAsStream("data/bookstore.json"); str = IOUtils.toString(is, "UTF-8"); } catch (Exception ex) { ex.printStackTrace(); } } @...
Options options = new OptionsBuilder() .include(BookStore.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) .build(); new Runner(options).run();
226
72
298
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jsonpath/JSONPathMultiBenchmark.java
JSONPathMultiBenchmark
evalMulti
class JSONPathMultiBenchmark { private static String str; static JSONPath jsonPath; static JSONPath path0; static JSONPath path1; static { try { InputStream is = BookStore.class.getClassLoader().getResourceAsStream("data/path_02.json"); str = IOUtils.toString(is, "U...
JSONObject object = JSON.parseObject(str); Object[] values = new Object[2]; values[0] = TypeUtils.cast(path0.eval(object), String.class); values[1] = TypeUtils.cast(path1.eval(object), BigDecimal.class); bh.consume(values);
460
85
545
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jsonpath/JSONPathMultiBenchmark2.java
JSONPathMultiBenchmark2
evalMulti
class JSONPathMultiBenchmark2 { private static String str; static String[] paths = { "$.media.bitrate", "$.media.duration", "$.media.format", "$.media.height", "$.media.persons", "$.media.player", "$.media.size", "$...
JSONObject object = JSON.parseObject(str); Object[] values = new Object[jsonPaths.size()]; for (int i = 0; i < values.length; i++) { JSONPath jsonPath = jsonPaths.get(i); Object evalResult = jsonPath.eval(object); values[i] = TypeUtils.cast(evalResult, types[...
580
112
692
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jsonschema/JSONSchemaBenchmark2.java
BenchmarkState
everit
class BenchmarkState { // everit private Schema jsonSchemaEverit; private org.json.JSONObject schemasEverit; private List<String> schemaNames; // fastjson private JSONSchema jsonSchemaFastjson2; private JSONObject schemasFastjson2; private JsonSchema jso...
for (String name : state.schemaNames) { org.json.JSONObject json = (org.json.JSONObject) state.schemasEverit.get(name); state.jsonSchemaEverit.validate(json); }
559
62
621
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/BigDecimal20.java
BigDecimal20
kryo
class BigDecimal20 { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); static Gson gson = new Gson(); static Kryo kryo; static byte[] kryoBytes; static byte[] hessianBytes; // static io.fury.ThreadSafeFury furyCompatible = io.fury.Fury.builder...
Input input = new Input(kryoBytes); BigDecimal20Field object = kryo.readObject(input, BigDecimal20Field.class); bh.consume(object);
1,149
54
1,203
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/BigDecimal20Tree.java
BigDecimal20Tree
main
class BigDecimal20Tree { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public BigDecimal20Tree() { try { InputStream is = BigDecimal20Tree.class.getClassLoader().getResourceAsStream("data/dec20.json"); str = IOUtils.toStrin...
Options options = new OptionsBuilder() .include(BigDecimal20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
391
87
478
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/BigInteger20.java
BigInteger20
main
class BigInteger20 { static BigInteger20Field bean; static ObjectMapper mapper = new ObjectMapper(); static Gson gson = new Gson(); public BigInteger20() { try { InputStream is = BigInteger20.class.getClassLoader().getResourceAsStream("data/bigint20.json"); String str =...
Options options = new OptionsBuilder() .include(BigInteger20.class.getName()) .exclude(BigDecimal20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) ...
546
102
648
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Date20.java
Date20
main
class Date20 { static String str; static byte[] jsonbBytes; static String str_millis; static ObjectMapper mapper = new ObjectMapper(); public Date20() { try { InputStream is = Date20.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toStri...
Options options = new OptionsBuilder() .include(Date20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
664
84
748
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Date20TreeWrite.java
Date20TreeWrite
main
class Date20TreeWrite { static String str; static List array; static ObjectMapper mapper = new ObjectMapper(); public Date20TreeWrite() { try { InputStream is = Date20TreeWrite.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toString(is, "UT...
Options options = new OptionsBuilder() .include(Date20TreeWrite.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
625
86
711
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Date20Write.java
Date20Write
main
class Date20Write { static String str; static Date20Field object; static ObjectMapper mapper = new ObjectMapper(); public Date20Write() { try { InputStream is = Date20Write.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toString(is, "UTF-8"...
Options options = new OptionsBuilder() .include(Date20Write.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
442
85
527
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Double20Tree.java
Double20Tree
main
class Double20Tree { static String str; static ObjectMapper mapper = new ObjectMapper(); public Double20Tree() { try { InputStream is = Double20Tree.class.getClassLoader().getResourceAsStream("data/dec20.json"); str = IOUtils.toString(is, "UTF-8"); } catch (Exception...
Options options = new OptionsBuilder() .include(Double20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
251
85
336
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/DoubleValue20.java
DoubleValue20
main
class DoubleValue20 { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); static final Class<DoubleValue20Field> OBJECT_CLASS = DoubleValue20Field.class; public DoubleValue20() { try { InputStream is = DoubleValue20.class.getClassLoader(...
Options options = new OptionsBuilder() .include(DoubleValue20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
486
85
571
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/DoubleValue20L.java
DoubleValue20L
main
class DoubleValue20L { static final String str = "{\"v0000\":0.7790456752571444,\"v0001\":0.660951133487578,\"v0002\":0.016859966762709178,\"v0003\":0.08792646995171371,\"v0004\":0.5004314371646074,\"v0005\":0.40819072662809397,\"v0006\":0.467977801426522,\"v0007\":0.5157402268914001,\"v0008\":0.02573911575880017,\...
Options options = new OptionsBuilder() .include(DoubleValue20L.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
1,008
86
1,094
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Float20Tree.java
Float20Tree
main
class Float20Tree { static String str; static ObjectMapper mapper = new ObjectMapper(); public Float20Tree() { try { InputStream is = Float20Tree.class.getClassLoader().getResourceAsStream("data/dec20.json"); str = IOUtils.toString(is, "UTF-8"); } catch (Exception ex...
Options options = new OptionsBuilder() .include(Float20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
253
85
338
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/FloatValue20.java
FloatValue20
main
class FloatValue20 { static String str; static ObjectMapper mapper = new ObjectMapper(); public FloatValue20() { try { InputStream is = FloatValue20.class.getClassLoader().getResourceAsStream("data/dec20.json"); str = IOUtils.toString(is, "UTF-8"); } catch (Exception...
Options options = new OptionsBuilder() .include(FloatValue20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
312
85
397
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Instant20.java
Instant20
main
class Instant20 { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public Instant20() { try { InputStream is = Instant20.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toString(is, "UTF-8"); ...
Options options = new OptionsBuilder() .include(Instant20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
406
85
491
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/Int20Tree.java
Int20Tree
main
class Int20Tree { static String str; static ObjectMapper mapper = new ObjectMapper(); public Int20Tree() { try { InputStream is = Int20Tree.class.getClassLoader().getResourceAsStream("data/Int20.json"); str = IOUtils.toString(is, "UTF-8"); } catch (Exception ex) { ...
Options options = new OptionsBuilder() .include(Int20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
355
85
440
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/IntValue20.java
IntValue20
main
class IntValue20 { static final Class OBJECT_CLASS = Int20Field.class; static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public IntValue20() { try { InputStream is = IntValue20.class.getClassLoader().getResourceAsStream("data/Int20.jso...
Options options = new OptionsBuilder() .include(OBJECT_CLASS.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
476
83
559
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/LocalDate20.java
LocalDate20
main
class LocalDate20 { static String str = "{\n" + " \"v0000\" : \"2001-07-01\",\n" + " \"v0001\" : \"2011-06-02\",\n" + " \"v0002\" : \"2021-11-03\",\n" + " \"v0003\" : \"2001-11-14\",\n" + " \"v0004\" : \"2002-10-07\",\n" + " \"v0005\" : \...
Options options = new OptionsBuilder() .include(LocalDate20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
822
85
907
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/LocalDateBench.java
LocalDateBench
utf16
class LocalDateBench { private static final LocalDate VALUE = LocalDate.of(2024, 2, 20); public void utf8(Blackhole BH) { JSONWriter jsonWriter = JSONWriter.ofUTF8(); jsonWriter.startArray(); for (int i = 0; i < 1000; i++) { if (i != 0) { jsonWriter.writeCom...
JSONWriter jsonWriter = JSONWriter.ofUTF16(); jsonWriter.startArray(); for (int i = 0; i < 1000; i++) { if (i != 0) { jsonWriter.writeComma(); } jsonWriter.writeLocalDate(VALUE); } jsonWriter.endArray(); BH.consume(js...
189
112
301
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/LocalDateTime20.java
LocalDateTime20
main
class LocalDateTime20 { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public LocalDateTime20() { try { InputStream is = LocalDateTime20.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toString(...
Options options = new OptionsBuilder() .include(LocalDateTime20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
406
85
491
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/OffsetDateTime20.java
OffsetDateTime20
main
class OffsetDateTime20 { static ObjectMapper mapper = new ObjectMapper(); static OffsetDateTime20Field object = new OffsetDateTime20Field(); public OffsetDateTime20() { try { InputStream is = OffsetDateTime20.class.getClassLoader().getResourceAsStream("data/date20.json"); St...
Options options = new OptionsBuilder() .include(OffsetDateTime20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
387
85
472
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/ShortBench.java
ShortBench
bean_jsonBytes
class ShortBench { private static final short[] VALUES; static { short[] shorts = new short[Short.MAX_VALUE - Short.MIN_VALUE]; for (int i = 0; i < shorts.length; i++) { shorts[i] = (short) (Short.MIN_VALUE + i); } VALUES = shorts; } public void utf8(Blackho...
for (int i = 0; i + 10 <= VALUES.length; i += 10) { Bean bean = new Bean(); bean.v0 = VALUES[i]; bean.v1 = VALUES[i + 1]; bean.v2 = VALUES[i + 2]; bean.v3 = VALUES[i + 3]; bean.v4 = VALUES[i + 4]; bean.v5 = VALUES[i + 5]; ...
752
192
944
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/String20.java
String20
main
class String20 { static final Class OBJECT_CLASS = com.alibaba.fastjson2.benchmark.primitves.vo.String20.class; static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public String20() { try { InputStream is = String20.class.getClassLoader(...
Options options = new OptionsBuilder() .include(String20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
493
84
577
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/String20Tree.java
String20Tree
main
class String20Tree { static String str; static ObjectMapper mapper = new ObjectMapper(); public String20Tree() { try { InputStream is = String20Tree.class.getClassLoader().getResourceAsStream("data/String20_compact.json"); str = IOUtils.toString(is, "UTF-8"); } catch...
Options options = new OptionsBuilder() .include(String20Tree.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
296
85
381
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/StringField20.java
StringField20
fastjson1_perf_test
class StringField20 { static String str; static ObjectMapper mapper = new ObjectMapper(); public StringField20() { try { InputStream is = StringField20.class.getClassLoader().getResourceAsStream("data/String20_compact.json"); str = IOUtils.toString(is, "UTF-8"); } ca...
for (int i = 0; i < 10; i++) { fastjson1_perf(); }
953
33
986
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/primitves/ZonedDateTime20.java
ZonedDateTime20
main
class ZonedDateTime20 { static String str; static byte[] jsonbBytes; static ObjectMapper mapper = new ObjectMapper(); public ZonedDateTime20() { try { InputStream is = ZonedDateTime20.class.getClassLoader().getResourceAsStream("data/date20.json"); str = IOUtils.toString(...
Options options = new OptionsBuilder() .include(ZonedDateTime20.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
413
86
499
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/protobuf/MediaContentTransform.java
MediaContentTransform
forwardSize
class MediaContentTransform { public static MediaContent reverse(MediaContentHolder.MediaContent mc) { List<Image> images = new ArrayList<Image>(mc.getImageCount()); for (MediaContentHolder.Image image : mc.getImageList()) { images.add(reverseImage(image)); } return new...
switch (s) { case SMALL: return MediaContentHolder.Image.Size.SMALL; case LARGE: return MediaContentHolder.Image.Size.LARGE; default: throw new AssertionError("invalid case: " + s); }
1,100
73
1,173
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/schema/JSONSchemaBenchmark1.java
JSONSchemaBenchmark1
format_perf
class JSONSchemaBenchmark1 { static final JSONSchema SCHEMA_UUID = JSONObject.of("type", "string", "format", "uuid").to(JSONSchema::of); static final JSONSchema SCHEMA_DATETIME = JSONObject.of("type", "string", "format", "date-time").to(JSONSchema::of); static final JSONSchema SCHEMA_DATE = JSONObject.of("t...
long start = System.currentTimeMillis(); for (int i = 0; i < 1000 * 1000 * 100; ++i) { // SCHEMA_UUID.isValid("a7f41390-39a9-4ca6-a13b-88cf07a41108"); // SCHEMA_DATETIME.isValid("2017-07-21 12:13:14"); // 123 // SCHEMA_DATE.isValid("2017-07-21"); // 48 // SCH...
672
376
1,048
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/sonic/EishayTest.java
EishayTest
main
class EishayTest { public static void main(String[] args) throws Exception {<FILL_FUNCTION_BODY>} public static class MediaContent implements java.io.Serializable { public Media media; public List<Image> images; public MediaContent() { } public void setMedi...
String str = "{\"images\": [{\n" + " \"height\":768,\n" + " \"size\":\"LARGE\",\n" + " \"title\":\"Javaone Keynote\",\n" + " \"uri\":\"http://javaone.com/keynote_large.jpg\",\n" + " \"width\":1024\n" + ...
1,026
886
1,912
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/twitter/TwitterParseString.java
TwitterParseString
main
class TwitterParseString { static String str; static final ObjectMapper mapper = new ObjectMapper(); static final Gson gson = new Gson(); static { try { InputStream is = TwitterParseString.class.getClassLoader().getResourceAsStream("data/twitter.json"); str = IOUtils.toS...
Options options = new OptionsBuilder() .include(TwitterParseString.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .threads(16) .build(); ...
246
94
340
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/utf8/UTF8Encode.java
CacheItem
encode
class CacheItem { volatile char[] chars; volatile byte[] bytes; } static final String STR_CN_SMALL = "規定了四種表"; static final String STR0 = "EEE 754規定了四種表示浮點數值的方式:單精確度(32位元)、雙精確度(64位元)、延伸單精確度(43位元以上,很少使用)與延伸雙精確度(79位元以上,通常以80位元實做)。只有32位元模式有強制要求,其他都是選擇性的。大部分程式語言都提供了IEEE浮点数格式與算術,但有些將其列為非必需的。例如,I...
if (JDKUtils.JVM_VERSION <= 8 || JDKUtils.STRING_CODER == null) { return jdk8(str); } int coder = JDKUtils.STRING_CODER.applyAsInt(str); byte[] value = JDKUtils.STRING_VALUE.apply(str); if (coder == 0) { boolean hasNegative; try { ...
974
388
1,362
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/DateWriteCase.java
DateWriteCase
main
class DateWriteCase { static DateBean2 object = new DateBean2(); static ObjectMapper mapper = new ObjectMapper(); @Benchmark public void fastjson2(Blackhole bh) { bh.consume( JSON.toJSONString(object) ); } @Benchmark public void jackson(Blackhole bh) throws ...
Options options = new OptionsBuilder() .include(DateWriteCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
215
84
299
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/EishayWriterCase.java
EishayWriterCase
main
class EishayWriterCase { static String result = "{\"images\":[{\"height\":768,\"size\":\"LARGE\",\"title\":\"Javaone Keynote\",\"uri\":\"http://javaone.com/keynote_large.jpg\",\"width\":1024},{\"height\":240,\"size\":\"SMALL\",\"title\":\"Javaone Keynote\",\"uri\":\"http://javaone.com/keynote_small.jpg\",\"width\":...
Options options = new OptionsBuilder() .include(EishayWriterCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) .build(); new Runner(options).run();
485
75
560
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/Int32ValueBeanCase.java
Int32ValueBeanCase
main
class Int32ValueBeanCase { static String result = "{\"a\":269072307,\"b\":-1518251888,\"c\":1718732377,\"d\":-680809737,\"e\":366417267,\"f\":-385913708,\"h\":-1059329988,\"i\":-1143820253,\"j\":1981317426,\"k\":141784471}"; static ObjectMapper mapper = new ObjectMapper(); @Benchmark public void jackso...
// io.github.wycst.wast.json.JSON.parseObject(result, NumberValueBean.class); Options options = new OptionsBuilder() .include(Int32ValueBeanCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) ...
370
116
486
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/LongTextParse2.java
LongTextParse2
main
class LongTextParse2 { static final ObjectMapper mapper = new ObjectMapper(); private static String simpleResult; static { int length = 10000; StringBuffer value = new StringBuffer(); for (int i = 0; i < length; i++) { value.append("a"); } Map map = new ...
Options options = new OptionsBuilder() .include(LongTextParse2.class.getName()) .exclude(LongTextParse2Escape.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.SECONDS) .warmupIterations(3) .forks(1) ...
490
100
590
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/LongTextParse2Escape.java
LongTextParse2Escape
main
class LongTextParse2Escape { static final ObjectMapper mapper = new ObjectMapper(); private static String escapeResult; static { int length = 1000; StringBuffer value = new StringBuffer(); for (int i = 0; i < length; i++) { char ch = (char) (i % 32); value.ap...
Options options = new OptionsBuilder() .include(LongTextParse2Escape.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.SECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run(); ...
511
85
596
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/LongTextParseCase.java
LongTextParseCase
main
class LongTextParseCase { static ObjectMapper mapper = new ObjectMapper(); private static String simpleResult; private static String simplePrettyResult; private static String escapeResult; private static String escapePrettyResult; static { int length = 10000; StringBuffer value...
Options options = new OptionsBuilder() .include(LongTextParseCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.SECONDS) .warmupIterations(3) .forks(1) .build(); new Runner(options).run();
1,663
83
1,746
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/NumberValueBeanCase.java
NumberValueBeanCase
main
class NumberValueBeanCase { static String result; static ObjectMapper mapper = new ObjectMapper(); static { NumberValueBean numberValueBean = new NumberValueBean(); numberValueBean.setValue1(-1547783865); numberValueBean.setValue2(-764506995); numberValueBean.setValue3(-3476...
// io.github.wycst.wast.json.JSON.parseObject(result, NumberValueBean.class); Options options = new OptionsBuilder() .include(NumberValueBeanCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .warmupIterations(3) ...
514
114
628
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/SimpleBeanCase.java
SimpleBeanCase
main
class SimpleBeanCase { private static String result; static ObjectMapper mapper = new ObjectMapper(); static { Map simpleMap = new HashMap(); simpleMap.put("id", 1); simpleMap.put("date", new Date()); simpleMap.put("name", "simple"); simpleMap.put("percent", 12.34); ...
Options options = new OptionsBuilder() .include(SimpleBeanCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) .build(); new Runner(options).run();
512
73
585
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/SimpleBeanWriteCase.java
SimpleBeanWriteCase
main
class SimpleBeanWriteCase { private static String result; static ObjectMapper mapper = new ObjectMapper(); private static Object simpleBean; static { mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); Map simpleMap = new HashMap(); simpleMap.put("id", 1); s...
Options options = new OptionsBuilder() .include(SimpleBeanWriteCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) .build(); new Runner(options).run();
557
74
631
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/SuperLongText.java
SuperLongText
main
class SuperLongText { private static String result; static ObjectMapper mapper = new ObjectMapper(); static { try ( InputStream fis = LargeFile26MTest.class.getClassLoader().getResourceAsStream("data/citylots.json.zip"); BufferedInputStream bis = new BufferedInputStr...
Options options = new OptionsBuilder() .include(SuperLongText.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MINUTES) .forks(1) .build(); new Runner(options).run();
404
71
475
<no_super_class>
alibaba_fastjson2
fastjson2/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/wast/WriteCase.java
WriteCase
main
class WriteCase { private static Map map1; private static Map escapeMap; static ObjectMapper mapper = new ObjectMapper(); static { int len = 200; StringBuffer buffer = new StringBuffer(); for (int i = 0; i < len; i++) { buffer.append("a"); } Map map =...
Options options = new OptionsBuilder() .include(WriteCase.class.getName()) .mode(Mode.Throughput) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) .build(); new Runner(options).run();
955
72
1,027
<no_super_class>
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/codegen/ClassWriter.java
ClassWriter
toString
class ClassWriter { final String packageName; final String name; final Class superClass; final Class[] interfaces; private Set<String> imports = new TreeSet<>(); private List<FieldWriter> fields = new ArrayList<>(); private List<MethodWriter> methods = new ArrayList<>(); public ClassWr...
if (packageName != null && !packageName.isEmpty()) { buf.append("package ").append(packageName).append(";\n\n"); } if (!imports.isEmpty()) { for (String item : imports) { buf.append("import ").append(item).append(";\n"); } } ...
467
322
789
<no_super_class>
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/codegen/MethodWriter.java
MethodWriter
toString
class MethodWriter extends Block { final ClassWriter classWriter; final int modifiers; final String name; final Class returnType; final Class[] paramTypes; final String[] paramNames; MethodWriter(ClassWriter classWriter, int modifiers, String name, Class returnType, Class[] paramTyp...
if (Modifier.isPublic(modifiers)) { buf.append("\tpublic "); } if ("<init>".equals(name)) { buf.append(classWriter.name); } else { buf.append(getTypeName(returnType)).append(' ').append(name); } boolean newLine = paramTypes.length > ...
223
368
591
<methods>public non-sealed void <init>() ,public void breakStmt() ,public void breakStmt(java.lang.String) ,public void continueStmt() ,public void continueStmt(java.lang.String) ,public com.alibaba.fastjson2.internal.codegen.Block.Statement declare(Class#RAW, com.alibaba.fastjson2.internal.codegen.Opcodes.OpName) ,pub...
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/codegen/Opcodes.java
Cast
toString
class Cast implements Op { public final String type; public final Op value; public Cast(String type, Op value) { this.type = type; this.value = value; } public void toString(MethodWriter mw, StringBuilder buf, int indent) {<FILL_FUNCTION_BODY...
buf.append('(').append(type).append(") "); boolean quote = value instanceof OpBinary; if (quote) { buf.append('('); } value.toString(mw, buf, indent); if (quote) { buf.append(')'); }
91
79
170
<no_super_class>
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/processor/Analysis.java
Analysis
findRelatedReferences
class Analysis { final ProcessingEnvironment processingEnv; final Elements elements; private final Types types; final TypeElement jsonCompiledElement; final TypeElement jsonTypeElement; public final DeclaredType compiledJsonType; final Map<String, StructInfo> structs = new LinkedHashMap<>();...
for (Map.Entry<String, StructInfo> entry : structs.entrySet()) { StructInfo info = entry.getValue(); for (TypeElement inheritance : getTypeHierarchy(info.element)) { for (VariableElement field : ElementFilter.fieldsIn(inheritance.getEnclosedElements())) { ...
1,083
665
1,748
<no_super_class>
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/processor/JSONBaseAnnotationProcessor.java
JSONBaseAnnotationProcessor
addOpensSinceJava9
class JSONBaseAnnotationProcessor extends AbstractProcessor { @Override public synchronized void init(ProcessingEnvironment processingEnv) { addOpensSinceJava9(); super.init(unwrapProcessingEnv(processingEnv)); } @Override public boolean process(Set<? extends TypeElement> an...
if (JVM_VERSION >= 9) { Class<?> cModule = null; try { cModule = Class.forName("java.lang.Module"); } catch (ClassNotFoundException e) { // just ignore } Object jdkCompilerModule = getJdkCompilerModule(); Ob...
378
369
747
<methods>public Iterable<? extends javax.annotation.processing.Completion> getCompletions(javax.lang.model.element.Element, javax.lang.model.element.AnnotationMirror, javax.lang.model.element.ExecutableElement, java.lang.String) ,public Set<java.lang.String> getSupportedAnnotationTypes() ,public Set<java.lang.String> g...
alibaba_fastjson2
fastjson2/codegen/src/main/java/com/alibaba/fastjson2/internal/processor/StructInfo.java
StructInfo
getAttributeByMethod
class StructInfo { final int modifiers; final boolean referenceDetect; final boolean smartMatch; String typeKey; int readerFeatures; int writerFeatures; final TypeElement element; final DeclaredType discoveredBy; final String name; final String binaryName; final Map<String, ...
AttributeInfo attr = attributes.get(name); if (attr == null) { attr = new AttributeInfo(name, type, null, getter, setter, null); AttributeInfo origin = attributes.putIfAbsent(name, attr); if (origin != null) { attr = origin; } } ...
701
143
844
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONFactory.java
CacheItem
getDefaultObjectReaderProvider
class CacheItem { volatile char[] chars; volatile byte[] bytes; } static final Properties DEFAULT_PROPERTIES; static final ObjectWriterProvider defaultObjectWriterProvider = new ObjectWriterProvider(); static final ObjectReaderProvider defaultObjectReaderProvider = new ObjectReaderProv...
ObjectReaderProvider providerLocal = readerProviderLocal.get(); if (providerLocal != null) { return providerLocal; } return defaultObjectReaderProvider;
1,709
46
1,755
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathFilter.java
NameDecimalOpSegment
apply
class NameDecimalOpSegment extends NameFilter { final Operator operator; final BigDecimal value; public NameDecimalOpSegment(String name, long nameHashCode, Operator operator, BigDecimal value) { super(name, nameHashCode); this.operator = operator; ...
if (fieldValue == null) { return false; } BigDecimal fieldValueDecimal; if (fieldValue instanceof Boolean) { fieldValueDecimal = (Boolean) fieldValue ? BigDecimal.ONE : BigDecimal.ZERO; } else if (fieldValue instanceof Byte ...
138
329
467
<methods>public abstract void accept(com.alibaba.fastjson2.JSONReader, com.alibaba.fastjson2.JSONPath.Context) ,public boolean contains(com.alibaba.fastjson2.JSONPath.Context) ,public abstract void eval(com.alibaba.fastjson2.JSONPath.Context) ,public boolean remove(com.alibaba.fastjson2.JSONPath.Context) ,public void s...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSegment.java
RangeIndexSegment
remove
class RangeIndexSegment extends JSONPathSegment { final int begin; final int end; public RangeIndexSegment(int begin, int end) { this.begin = begin; this.end = end; } @Override public void eval(JSONPath.Context context) { ...
Object object = context.parent == null ? context.root : context.parent.value; if (object instanceof List) { List list = (List) object; int removeCount = 0; for (int size = list.size(), i = size - 1; i >= 0;...
1,781
157
1,938
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingle.java
JSONPathSingle
setInt
class JSONPathSingle extends JSONPath { final JSONPathSegment segment; final boolean ref; final boolean extractSupport; JSONPathSingle(JSONPathSegment segment, String path, Feature... features) { super(path, features); this.segment = segment; this.ref = segment instanceo...
Context context = new Context(this, null, segment, null, 0); context.root = root; segment.setInt(context, value);
869
41
910
<methods>public transient void arrayAdd(java.lang.Object, java.lang.Object[]) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String, Class#RAW) ,public static boolean contains(java.lang.Object, java.lang.String) ,public abstract bo...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleIndex.java
JSONPathSingleIndex
extract
class JSONPathSingleIndex extends JSONPathSingle { final JSONPathSegmentIndex segment; final int index; public JSONPathSingleIndex(String path, JSONPathSegmentIndex segment, Feature... features) { super(segment, path, features); this.segment = segment; this.index = segment.i...
if (jsonReader.nextIfNull()) { return null; } int max = jsonReader.startArray(); if (jsonReader.jsonb && index >= max) { return null; } if ((!jsonReader.jsonb) && jsonReader.nextIfArrayEnd()) { return null; } for (in...
257
159
416
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public final com.alibaba.fastjson2.JSONPath getParent() ,public boolean isRef() ...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleNameDecimal.java
JSONPathSingleNameDecimal
extract
class JSONPathSingleNameDecimal extends JSONPathTyped { final long nameHashCode; final String name; public JSONPathSingleNameDecimal(JSONPathSingleName jsonPath) { super(jsonPath, BigDecimal.class); this.nameHashCode = jsonPath.nameHashCode; this.name = jsonPath.name; } ...
if (jsonReader.jsonb) { if (jsonReader.isObject()) { jsonReader.nextIfObjectStart(); while (!jsonReader.nextIfObjectEnd()) { long nameHashCode = jsonReader.readFieldNameHashCode(); if (nameHashCode == 0) { ...
122
259
381
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public java.lang.reflect.Type...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleNameInteger.java
JSONPathSingleNameInteger
extract
class JSONPathSingleNameInteger extends JSONPathTyped { final long nameHashCode; final String name; public JSONPathSingleNameInteger(JSONPathSingleName jsonPath) { super(jsonPath, Integer.class); this.nameHashCode = jsonPath.nameHashCode; this.name = jsonPath.name; } ...
if (jsonReader.jsonb) { if (jsonReader.isObject()) { jsonReader.nextIfObjectStart(); while (!jsonReader.nextIfObjectEnd()) { long nameHashCode = jsonReader.readFieldNameHashCode(); if (nameHashCode == 0) { ...
118
259
377
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public java.lang.reflect.Type...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleNameLong.java
JSONPathSingleNameLong
extract
class JSONPathSingleNameLong extends JSONPathTyped { final long nameHashCode; final String name; public JSONPathSingleNameLong(JSONPathSingleName jsonPath) { super(jsonPath, Long.class); this.nameHashCode = jsonPath.nameHashCode; this.name = jsonPath.name; } @Overri...
if (jsonReader.jsonb) { if (jsonReader.isObject()) { jsonReader.nextIfObjectStart(); while (!jsonReader.nextIfObjectEnd()) { long nameHashCode = jsonReader.readFieldNameHashCode(); if (nameHashCode == 0) { ...
118
259
377
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public java.lang.reflect.Type...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleNameString.java
JSONPathSingleNameString
extract
class JSONPathSingleNameString extends JSONPathTyped { final long nameHashCode; final String name; public JSONPathSingleNameString(JSONPathSingleName jsonPath) { super(jsonPath, String.class); this.nameHashCode = jsonPath.nameHashCode; this.name = jsonPath.name; } @...
if (jsonReader.jsonb) { if (jsonReader.isObject()) { jsonReader.nextIfObjectStart(); while (!jsonReader.nextIfObjectEnd()) { long nameHashCode = jsonReader.readFieldNameHashCode(); if (nameHashCode == 0) { ...
118
255
373
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public java.lang.reflect.Type...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTyped.java
JSONPathTyped
of
class JSONPathTyped extends JSONPath { final JSONPath jsonPath; final Type type; protected JSONPathTyped(JSONPath jsonPath, Type type) { super(jsonPath.path, jsonPath.features); this.type = type; this.jsonPath = jsonPath; } @Override public JSONPath getParent() {...
if (type == null || type == Object.class) { return jsonPath; } if (jsonPath instanceof JSONPathTyped) { JSONPathTyped jsonPathTyped = (JSONPathTyped) jsonPath; if (jsonPathTyped.type.equals(type)) { return jsonPath; } } ...
537
255
792
<methods>public transient void arrayAdd(java.lang.Object, java.lang.Object[]) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String, Class#RAW) ,public static boolean contains(java.lang.Object, java.lang.String) ,public abstract bo...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMulti.java
JSONPathTypedMulti
contains
class JSONPathTypedMulti extends JSONPath { final JSONPath[] paths; final Type[] types; final String[] formats; final long[] pathFeatures; final ZoneId zoneId; protected JSONPathTypedMulti( JSONPath[] paths, Type[] types, String[] formats, ...
for (JSONPath jsonPath : paths) { if (jsonPath.contains(object)) { return true; } } return false;
845
43
888
<methods>public transient void arrayAdd(java.lang.Object, java.lang.Object[]) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String) ,public static com.alibaba.fastjson2.JSONPath compile(java.lang.String, Class#RAW) ,public static boolean contains(java.lang.Object, java.lang.String) ,public abstract bo...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMultiIndexes.java
JSONPathTypedMultiIndexes
extract
class JSONPathTypedMultiIndexes extends JSONPathTypedMulti { final JSONPath prefix; final JSONPath[] indexPaths; final int[] indexes; final int maxIndex; final boolean duplicate; JSONPathTypedMultiIndexes( JSONPath[] paths, JSONPath prefix, JSONPath[]...
if (jsonReader.nextIfNull()) { return new Object[indexes.length]; } if (prefix instanceof JSONPathSingleName) { JSONPathSingleName prefixName = (JSONPathSingleName) prefix; long prefixNameHash = prefixName.nameHashCode; if (!jsonReader.nextIfObje...
1,050
706
1,756
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public boolean isRef() ,publi...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMultiNames.java
JSONPathTypedMultiNames
eval
class JSONPathTypedMultiNames extends JSONPathTypedMulti { final JSONPath prefix; final JSONPath[] namePaths; final String[] names; final FieldReader[] fieldReaders; final ObjectReaderAdapter<Object[]> objectReader; JSONPathTypedMultiNames( JSONPath[] paths, JSON...
Object[] array = new Object[paths.length]; Object object = root; if (prefix != null) { object = prefix.eval(root); } if (object == null) { return new Object[paths.length]; } if (object instanceof Map) { return objectReader.c...
902
354
1,256
<methods>public boolean contains(java.lang.Object) ,public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public java.lang.String extractScalar(com.alibaba.fastjson2.JSONReader) ,public com.alibaba.fastjson2.JSONPath getParent() ,public boolean isRef() ,publi...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMultiNamesPrefixIndex1.java
JSONPathTypedMultiNamesPrefixIndex1
extract
class JSONPathTypedMultiNamesPrefixIndex1 extends JSONPathTypedMultiNames { final int index; JSONPathTypedMultiNamesPrefixIndex1( JSONPath[] paths, JSONPathSingleIndex prefix, JSONPath[] namePaths, Type[] types, String[] formats, l...
if (jsonReader.nextIfNull()) { return new Object[paths.length]; } if (!jsonReader.nextIfArrayStart()) { throw new JSONException(jsonReader.info("illegal input, expect '[', but " + jsonReader.current())); } for (int i = 0; i < index; ++i) { i...
162
238
400
<methods>public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public boolean isRef() <variables>final non-sealed FieldReader#RAW[] fieldReaders,final non-sealed com.alibaba.fastjson2.JSONPath[] namePaths,final non-sealed java.lang.String[] names,final non-se...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMultiNamesPrefixName1.java
JSONPathTypedMultiNamesPrefixName1
extract
class JSONPathTypedMultiNamesPrefixName1 extends JSONPathTypedMultiNames { final JSONPathSingleName prefixName; final long prefixNameHash; JSONPathTypedMultiNamesPrefixName1( JSONPath[] paths, JSONPath prefix, JSONPath[] namePaths, Type[] types, ...
if (jsonReader.nextIfNull()) { return new Object[paths.length]; } if (!jsonReader.nextIfObjectStart()) { throw new JSONException(jsonReader.info("illegal input, expect '[', but " + jsonReader.current())); } while (true) { if (jsonReader.next...
190
294
484
<methods>public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public boolean isRef() <variables>final non-sealed FieldReader#RAW[] fieldReaders,final non-sealed com.alibaba.fastjson2.JSONPath[] namePaths,final non-sealed java.lang.String[] names,final non-se...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONPathTypedMultiNamesPrefixName2.java
JSONPathTypedMultiNamesPrefixName2
extract
class JSONPathTypedMultiNamesPrefixName2 extends JSONPathTypedMultiNames { final String prefixName0; final long prefixNameHash0; final String prefixName1; final long prefixNameHash1; JSONPathTypedMultiNamesPrefixName2( JSONPath[] paths, JSONPath prefix, ...
if (jsonReader.nextIfNull()) { return new Object[paths.length]; } if (!jsonReader.nextIfObjectStart()) { throw error(jsonReader); } while (true) { if (jsonReader.nextIfObjectEnd()) { return new Object[paths.length]; ...
328
359
687
<methods>public java.lang.Object eval(java.lang.Object) ,public java.lang.Object extract(com.alibaba.fastjson2.JSONReader) ,public boolean isRef() <variables>final non-sealed FieldReader#RAW[] fieldReaders,final non-sealed com.alibaba.fastjson2.JSONPath[] namePaths,final non-sealed java.lang.String[] names,final non-se...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONValidator.java
JSONValidator
validate
class JSONValidator { public enum Type { Object, Array, Value } private final JSONReader jsonReader; private Boolean validateResult; private Type type; protected JSONValidator(JSONReader jsonReader) { this.jsonReader = jsonReader; } public static JSONValidator fromUtf8...
if (validateResult != null) { return validateResult; } char firstChar; try { firstChar = jsonReader.current(); jsonReader.skipValue(); } catch (JSONException error) { return validateResult = false; } finally { ...
222
155
377
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF16JDK8.java
JSONWriterUTF16JDK8
writeString
class JSONWriterUTF16JDK8 extends JSONWriterUTF16 { JSONWriterUTF16JDK8(Context ctx) { super(ctx); } @Override public void writeString(String str) {<FILL_FUNCTION_BODY>} }
if (str == null) { if (isEnabled(Feature.NullAsDefaultValue.mask | Feature.WriteNullStringAsEmpty.mask)) { writeString(""); return; } writeNull(); return; } boolean browserSecure = (context.features & BrowserSecur...
73
399
472
<methods>public final void close() ,public final void endArray() ,public final void endObject() ,public final void flushTo(java.io.Writer) ,public final int flushTo(java.io.OutputStream) throws java.io.IOException,public final int flushTo(java.io.OutputStream, java.nio.charset.Charset) throws java.io.IOException,public...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF16JDK8UF.java
JSONWriterUTF16JDK8UF
writeString
class JSONWriterUTF16JDK8UF extends JSONWriterUTF16 { JSONWriterUTF16JDK8UF(Context ctx) { super(ctx); } @Override public void writeString(String str) {<FILL_FUNCTION_BODY>} }
if (str == null) { writeStringNull(); return; } boolean browserSecure = (context.features & BrowserSecure.mask) != 0; boolean escapeNoneAscii = (context.features & EscapeNoneAscii.mask) != 0; char[] value = (char[]) UNSAFE.getObject(str, JDKUtils.FIELD_S...
77
407
484
<methods>public final void close() ,public final void endArray() ,public final void endObject() ,public final void flushTo(java.io.Writer) ,public final int flushTo(java.io.OutputStream) throws java.io.IOException,public final int flushTo(java.io.OutputStream, java.nio.charset.Charset) throws java.io.IOException,public...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF16JDK9UF.java
JSONWriterUTF16JDK9UF
writeString
class JSONWriterUTF16JDK9UF extends JSONWriterUTF16 { JSONWriterUTF16JDK9UF(Context ctx) { super(ctx); } @Override public void writeString(String str) {<FILL_FUNCTION_BODY>} }
if (str == null) { writeStringNull(); return; } boolean escapeNoneAscii = (context.features & Feature.EscapeNoneAscii.mask) != 0; boolean browserSecure = (context.features & BrowserSecure.mask) != 0; boolean escape = false; final char quote = thi...
77
454
531
<methods>public final void close() ,public final void endArray() ,public final void endObject() ,public final void flushTo(java.io.Writer) ,public final int flushTo(java.io.OutputStream) throws java.io.IOException,public final int flushTo(java.io.OutputStream, java.nio.charset.Charset) throws java.io.IOException,public...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/JSONWriterUTF8JDK9.java
JSONWriterUTF8JDK9
writeString
class JSONWriterUTF8JDK9 extends JSONWriterUTF8 { JSONWriterUTF8JDK9(Context ctx) { super(ctx); } @Override public void writeString(String str) {<FILL_FUNCTION_BODY>} }
if (str == null) { writeStringNull(); return; } int coder = STRING_CODER.applyAsInt(str); byte[] value = STRING_VALUE.apply(str); if (coder == 0) { writeStringLatin1(value); } else { writeStringUTF16(value); } ...
70
98
168
<methods>public final void close() ,public final void endArray() ,public final void endObject() ,public final int flushTo(java.io.OutputStream) throws java.io.IOException,public final int flushTo(java.io.OutputStream, java.nio.charset.Charset) throws java.io.IOException,public final byte[] getBytes() ,public final byte...
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/SymbolTable.java
SymbolTable
getNameByHashCode
class SymbolTable { private final String[] names; private final long hashCode64; private final short[] mapping; private final long[] hashCodes; private final long[] hashCodesOrigin; public SymbolTable(String... input) { Set<String> set = new TreeSet<>(Arrays.asList(input)); nam...
int m = Arrays.binarySearch(hashCodes, hashCode); if (m < 0) { return null; } int index = this.mapping[m]; return names[index];
715
57
772
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/codec/BeanInfo.java
BeanInfo
required
class BeanInfo { public String typeKey; public String typeName; public Class builder; public Method buildMethod; public String builderWithPrefix; public Class[] seeAlso; public String[] seeAlsoNames; public Class seeAlsoDefault; public Constructor creatorConstructor; public Const...
if (schema == null) { schema = JSONObject.of("required", JSONArray.of(fieldName)).toString(); } else { JSONObject object = JSONObject.parseObject(schema); JSONArray array = object.getJSONArray("required"); array.add(fieldName); schema = object...
297
86
383
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/codec/DateTimeCodec.java
DateTimeCodec
getDateFormatter
class DateTimeCodec { public final String format; public final boolean formatUnixTime; public final boolean formatMillis; public final boolean formatISO8601; protected final boolean formatHasDay; protected final boolean formatHasHour; public final boolean useSimpleFormatter; public fin...
if (dateFormatter == null && format != null && !formatMillis && !formatISO8601 && !formatUnixTime) { if (locale == null) { dateFormatter = DateTimeFormatter.ofPattern(format); } else { dateFormatter = DateTimeFormatter.ofPattern(format, locale); ...
961
97
1,058
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/codec/FieldInfo.java
FieldInfo
getInitReader
class FieldInfo { public static final long VALUE_MASK = 1L << 48; public static final long UNWRAPPED_MASK = 1L << 49; public static final long RAW_VALUE_MASK = 1L << 50; public static final long READ_USING_MASK = 1L << 51; public static final long FIELD_MASK = 1L << 52; // public static final lon...
if (readUsing != null && ObjectReader.class.isAssignableFrom(readUsing)) { try { Constructor<?> constructor = readUsing.getDeclaredConstructor(); constructor.setAccessible(true); return (ObjectReader) constructor.newInstance(); } catch (Ex...
441
100
541
<no_super_class>
alibaba_fastjson2
fastjson2/core/src/main/java/com/alibaba/fastjson2/filter/AfterFilter.java
AfterFilter
writeKeyValue
class AfterFilter implements Filter { private static final ThreadLocal<JSONWriter> writerLocal = new ThreadLocal<>(); public void writeAfter(JSONWriter serializer, Object object) { JSONWriter last = writerLocal.get(); writerLocal.set(serializer); writeAfter(object); writ...
JSONWriter serializer = writerLocal.get(); boolean ref = serializer.containsReference(value); serializer.writeName(key); serializer.writeColon(); serializer.writeAny(value); if (!ref) { serializer.removeReference(value); }
128
77
205
<no_super_class>