Skip to content

Commit

Permalink
[0008_inline_strip] Strip inline, don't do a second iteration
Browse files Browse the repository at this point in the history
--------------------------------------------------------------------------------------------------------- benchmark: 4 tests ---------------------------------------------------------------------------------------------------------
Name (time in ns)                                     Min                     Max                  Mean                StdDev                Median                IQR            Outliers  OPS (Kops/s)            Rounds  Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_extract_tokens_short_simple       790.9257 (1.0)       25,041.9835 (1.00)       965.2633 (1.0)        690.2278 (5.36)       917.0035 (1.0)      42.0259 (1.02)      261;825    1,035.9868 (1.0)       55814           1
test_benchmark_extract_tokens_long_simple      1,207.9254 (1.53)     568,790.9434 (22.75)    1,424.0680 (1.48)     1,607.7592 (12.49)    1,415.9596 (1.54)     83.0041 (2.02)     544;6540      702.2137 (0.68)     179118           1
test_benchmark_extract_tokens_short_nested     1,499.8950 (1.90)      24,999.9575 (1.0)      1,632.3808 (1.69)       136.4377 (1.06)     1,625.0415 (1.77)     41.0946 (1.0)     1290;4671      612.6022 (0.59)     146349           1
test_benchmark_extract_tokens_long_nested      2,291.0535 (2.90)      28,708.0184 (1.15)     2,454.3364 (2.54)       128.6998 (1.0)      2,457.9931 (2.68)     42.0259 (1.02)    1624;8542      407.4421 (0.39)     146349           1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • Loading branch information
huonw committed Aug 26, 2024
1 parent aa5d838 commit 6d67769
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions casbin/persist/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ def _extract_tokens(line):
elif not stack:
# must be a comma outside of any nesting: we've found the end of a top level token so
# save that and start a new one
tokens.append(line[start_idx : match.start()])
tokens.append(line[start_idx : match.start()].strip())
start_idx = match.end()

# trailing token after the last ,
tokens.append(line[start_idx:])
tokens.append(line[start_idx:].strip())

tokens = [x.strip() for x in tokens]
return tokens


Expand Down

0 comments on commit 6d67769

Please sign in to comment.