Hacker News new | past | comments | ask | show | jobs | submit login
Linear-log bucketing: fast, versatile, simple (2015) (pvk.ca)
42 points by signa11 on Jan 24, 2023 | hide | past | favorite | 5 comments



Linear-log -> asinh(x)

Its linear for small values and log for large. It also has the advantage that it is continuous and smooth. (Obviously asinh is not very useful for allocation)

I first thought of it while pondering an amp that would best use the limited dynamic range of a (analog) recording media. Thats what I do in my free time.

I later realized that asinh(f(x)) is a great substitute for log space when plotting. It preserves the sign and the small value details while compressing large values. Unfortunately no one os familiar with this mapping.

EDIT: from apeheele's comment below I noticed I made a mistake and its not tanh, but asinh that is linear for small x and logarithmic for large c.


One I have seen for time-series forecasting is the inverse-hyperbolic sine function as well, https://robjhyndman.com/hyndsight/transformations/.


Paul Khuong encouraged me to use this code to make my hg64 histogram bucketing faster: https://dotat.at/@/2022-10-12-histogram.html


Discussed at the time:

Linear-Log Bucketing: Fast, Versatile, Simple - https://news.ycombinator.com/item?id=9792184 - June 2015 (8 comments)


Sounds very similar to how memcached allocates slabs.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: