Skip to content

Use B_bool singletons in toB_bool(b)#2491

Merged
plajjan merged 1 commit into
mainfrom
bool-singleton
Oct 24, 2025
Merged

Use B_bool singletons in toB_bool(b)#2491
plajjan merged 1 commit into
mainfrom
bool-singleton

Conversation

@mzagozen

Copy link
Copy Markdown
Collaborator

Do not allocate a new B_bool whenever we need an Acton bool!

Do not allocate a new B_bool whenever we need an Acton bool!
@plajjan

plajjan commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

@mzagozen and I discussed this. I think this is a good idea and can't really see an issue. @nordlander please confirm this is OK

@nordlander

Copy link
Copy Markdown
Contributor

Definitely ok!

@plajjan plajjan merged commit a05ee5e into main Oct 24, 2025
35 checks passed
@plajjan plajjan deleted the bool-singleton branch October 24, 2025 17:57
@plajjan

plajjan commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

@mzagozen will this have a big impact? or switch from .index to .contains and it might make a diff??? would be interesting to hear...

@mzagozen

mzagozen commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator Author

25% in total. Switching to str.contains() is a small part of that, I guess there were many other bools passed around in other places.

baseline

Tests - module test_yang_compile:
  cisco_xrd_24_1_1:                     OK:    1 runs in 135455.949ms
  cisco_xe_17_15_03a:                   OK:    1 runs in 63710.030ms
  juniper_crpd_24_4R1_9:                OK:    1 runs in 28392.936ms
  nokia_sr_linux_25_3_2:                OK:    1 runs in 11406.830ms
  notconf:                              OK:    1 runs in 1119.706ms
  notconf_cisco_xr_2411:                OK:    1 runs in 141190.968ms
  notconf_juniper_crpd_24_4R1_9_local:  OK:    1 runs in 30829.212ms
All 7 tests passed (248.258s)

new compiler with singleton bool

Tests - module test_yang_compile:
  cisco_xrd_24_1_1:                     OK:    1 runs in 107280.432ms
  cisco_xe_17_15_03a:                   OK:    1 runs in 57292.421ms
  juniper_crpd_24_4R1_9:                OK:    1 runs in 21355.314ms
  nokia_sr_linux_25_3_2:                OK:    1 runs in 11124.353ms
  notconf:                              OK:    1 runs in 821.642ms
  notconf_cisco_xr_2411:                OK:    1 runs in 112144.519ms
  notconf_juniper_crpd_24_4R1_9_local:  OK:    1 runs in 22763.334ms
All 7 tests passed (205.144s)

new compiler with singleton bool and str.contains()

Tests - module test_yang_compile:
  cisco_xrd_24_1_1:                     OK:    1 runs in 96178.293ms
  cisco_xe_17_15_03a:                   OK:    1 runs in 52040.416ms
  juniper_crpd_24_4R1_9:                OK:    1 runs in 19913.000ms
  nokia_sr_linux_25_3_2:                OK:    1 runs in 10775.422ms
  notconf:                              OK:    1 runs in 549.304ms
  notconf_cisco_xr_2411:                OK:    1 runs in 100257.445ms
  notconf_juniper_crpd_24_4R1_9_local:  OK:    1 runs in 20099.714ms
All 7 tests passed (186.459s)

@plajjan

plajjan commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Those are some fantastic gains!

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.

3 participants