Skip to content

Commit 947d576

Browse files
committed
Speed up printing JSON to a string. Fixes #377
This was done by reducing the number of string allocations during this process. The string is now allocated in chunks of 1000 characters (which is sort of arbitrary). Some minor refactoring also.
1 parent a2af58c commit 947d576

File tree

2 files changed

+103
-70
lines changed

2 files changed

+103
-70
lines changed

src/json_parameters.F90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ module json_parameters
127127

128128
integer(IK),parameter :: stream_chunk_size = 256_IK !! chunk size for reading stream files
129129

130+
integer(IK),parameter :: print_str_chunk_size = 1000_IK !! chunk size for writing JSON to a string
131+
130132
integer(IK),parameter :: pushed_char_size = 10_IK !! size for `pushed_char`
131133
!! array in [[json_core(type)]]
132134

0 commit comments

Comments
 (0)