Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoder2: decode array #22556

Merged
merged 8 commits into from
Oct 18, 2024
Merged

Conversation

enghitalo
Copy link
Contributor

35% faster than older decode in arrays

Starting benchmark...
max_iterations: 1000000

***Structure and maps***
 SPENT   362.428 ms in old_json.decode(Stru, json_data)!

 SPENT   136.917 ms in decoder2.decode[StructType[string]](json_data1)!
 SPENT    97.051 ms in old_json.decode(StructType[string], json_data1)!

 SPENT   176.960 ms in decoder2.decode[StructTypeOption[string]](json_data1)!
 SPENT   108.812 ms in old_json.decode(StructTypeOption[string], json_data1)!

 SPENT   152.319 ms in decoder2.decode[StructType[int]](json_data2)!
 SPENT    99.679 ms in old_json.decode(StructType[int], json_data2)!

 SPENT   127.676 ms in decoder2.decode[map[string]string](json_data1)!
 SPENT   208.413 ms in old_json.decode(map[string]string, json_data1)!


***arrays***
 SPENT   381.573 ms in decoder2.decode[[]int]('[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]')!
 SPENT   589.276 ms in old_json.decode([]int, '[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]')!


***simple types***
 SPENT    33.200 ms in decoder2.decode[int]('2')!
 SPENT    31.594 ms in decoder2.decode[bool]('true')!

@enghitalo enghitalo changed the title Jso2/new decode2 rewrite decoder2: decode array Oct 17, 2024
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit 6583d3c into vlang:master Oct 18, 2024
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants