Mostly Linux & Python syntax notes and hyperlinks.

Wednesday, March 22, 2023

python len() for record offsets

 From a colleague:

In case you ever have to do an f.seek():

When calculating record offsets, python only does a consistent and correct len() value if your file is opened in binary.


Friday, March 3, 2023

Performance illusion from using repetitive test data

We often copy a few fake records to create a large input file with which to test how the code handles it.

It's a useful test; but don't use it to gauge performance. 

Data from repeated records can be cached and reused. If your production data will vary, then it won't get the same use out of caching. Caching could even hurt performance.