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

Remove remaining uses of FFI under -fpure-haskell #660

Merged
merged 4 commits into from
Feb 15, 2024

Commits on Feb 14, 2024

  1. Configuration menu
    Copy the full SHA
    7e87911 View commit details
    Browse the repository at this point in the history
  2. Remove remaining uses of FFI under -fpure-haskell

    All of these were standard C functions that GHC's JS backend
    actually somewhat supports; their shims can be found in the
    compiler source at "rts/js/mem.js".  But it seems simpler to
    just get rid of all FFI uses with -fpure-haskell rather than
    try to keep track of which functions GHC supports.
    
    The pure Haskell implementation of memcmp runs about 6-7x as fast
    as the simple one-byte-at-a-time implementation for long equal
    buffers, which makes it...  about the same speed as the
    pre-existing shim, even though the latter is also a one-byte-
    at-a-time implementation!
    
    Apparently GHC's JS backend is not yet able to produce efficient
    code for tight loops like these yet; the biggest problem is that
    it does not perform any loopification so each iteration must go
    through a generic-call indirection.
    
    Unfortunately that means that this patch probably makes 'strlen'
    and 'memchr' much slower with the JS backend.
    clyring committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    5f9c144 View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2024

  1. Configuration menu
    Copy the full SHA
    1880581 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    747324f View commit details
    Browse the repository at this point in the history