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

cif_loop_add_packet bottlenecks for input with large loops (~30000 rows) on ARM64 #21

Open
DylanLukes opened this issue Jan 17, 2018 · 1 comment

Comments

@DylanLukes
Copy link

DylanLukes commented Jan 17, 2018

In an application I am working on, cif_loop_add_packet has become a bottleneck on loading large CIF files. Real world examples include large protein complices such as RNA polymerase II.

The root of this problem seems to be that cif_api inserts packets into SQLite one at a time with cif_loop_add_packet. Profiling suggests that the issue is the accumulation of SQL overhead. To give some concrete numbers: for a 2.3MB CIF file containing a single entry, with a loop containing ~34,000 packets, on an Apple A9X ARM64 SOC, parsing takes up ~44s, of which 89% is spent in sqlite3_step.

I suspect this may be related to how the build configuration of iOS' system sqlite3, in particular journaling and caching configuration.

@DylanLukes DylanLukes changed the title cif_loop_add_packet bottlenecks for input with large loops (~30000 rows) cif_loop_add_packet bottlenecks for input with large loops (~30000 rows) on ARM64 Jan 17, 2018
@DylanLukes
Copy link
Author

I built an additional copy of libcif.a, disabling synchronous writes and keeping the journal in memory by adding DEBUG_WRAP(sqlite3_exec(temp->db, "pragma synchronous = off; pragma journal_mode = memory;", NULL, NULL, NULL)); to cif_create here:

/* Any other DB setup / configuration needed in the future should go here */

In this case, for the same file, ~20s is spent in cif_parse (of which 73% is spent in sqlite3_step).

For comparison, a copy of libcif.a with SQLITE_MEMORY_ONLY enabled takes only ~13s (of which 85% is spent in sqlite3_step)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants