An unofficial, read-only Hacker News reader.

Computer Disease (2020) (opens external site)

240 points by jvanderbot 16 hours ago | blog.adafruit.com | 96 comments on HN

View full thread · View on Hacker News

Comment thread (3)

  1. Actually, trigonometric tables are still used in high performance computing, because calculating those functions it's slower than reading them from s table. But as ram gets much slower than cpu, direct calculation is being used more.
    Replies (1)
    1. When I was a kid programming in BASIC, this was true. Precomputing lookup tables for trig functions was a significant speedup.

      But this hasn't been the case since at least the year 2000. A round-trip to main memory costs hundreds of clock cycles and it's just faster to recompute.

      Replies (1)
      1. No. Tables are still used.

        If you need to use a table only once, then you have to wait hundreds of cycles. But "only once" doesn't affects performance.

        When performance matter, you need to calculate it thousands of times, and the table stays in cache.

        On intermediate cases, you use a tiny table to get an approximate value, and rapidly iterate on the ALU to reduce the error.

        You never calculate the function without tabulation, because it consumes hundreds of cycles, and evicts registers/cache, or uses the stack which is a memory access anyways.