GithubHelp home page GithubHelp logo

Comments (5)

ruricolist avatar ruricolist commented on August 23, 2024 1

It did result in an improved expansion in SBCL when I wrote it, but when I check the disassembly it doesn't anymore, so I withdraw my suggestion.

from enhanced-boolean.

Hexstream avatar Hexstream commented on August 23, 2024

Thank you for the feedback, although I'm afraid I don't quite understand.

Note that enhanced-boolean:boolean is declaimed inline and its ftype is declared. I am confident that SBCL would intelligently use that information in most circumstances. I'm assuming there is no need to "trick" SBCL into detecting the boolean return type, since I already directly told SBCL (or any other conforming implementation) that the return type is boolean, and portably so.

The expected effect of the ftype declaration, especially along with the inline declaration, is that it is already as if each call to enhanced-boolean:boolean was enclosed in (the boolean). Because of the inline declaration, SBCL can already "see" in the function, so it has no need for the compiler macro, although no harm will be done if it does use it. And it doesn't even need to understand that (if foo t nil) (assuming no non-local exit in foo) always returns a boolean (since the ftype declaration already says it), although I suspect it might. Compiler macros must preserve the semantics of the function call, so SBCL can confidently rely on my declared return type.

Your comment in serapeum doesn't seem coherent to me, since if the compiler macro result does end up being used, then the "call" to true is therefore inherently eliminated, since it is explicitly inlined by the compiler macro. As far as I can tell, the "trick" your compiler macro uses probably just obscures the code for no reason, and might even result in slower code (but is guaranteed to result in slower compilation).

Please let me know if I missed anything, I certainly don't claim to be an optimization expert.

from enhanced-boolean.

Hexstream avatar Hexstream commented on August 23, 2024

Thank you, perhaps SBCL might have had a performance bug at that time (or you might just have got confused, it happens to everyone). Was this very long ago?

from enhanced-boolean.

ruricolist avatar ruricolist commented on August 23, 2024

According to git-blame it was August of 2017, so long enough.

from enhanced-boolean.

Hexstream avatar Hexstream commented on August 23, 2024

At the pace SBCL is developing, that was ages ago, yes. ;)

from enhanced-boolean.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.