[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61654] [ruby-trunk - Feature #9667] Optimization of __FILE__ and __dir__

From: sawadatsuyoshi@...
Date: 2014-03-24 09:25:23 UTC
List: ruby-core #61654
Issue #9667 has been updated by Tsuyoshi Sawada.


Sorry, my examples were inappropriate. Please ignore the examples above.
<hr>
Currently, different object id is returned each time:

    2.times{puts __FILE__.object_id}
    # => 70183725179420
    # => 70183725129020

I propose them to be optimized so that they are only created once per occurrence.

    2.times{puts __FILE__.object_id}
    # => 70183725179420
    # => 70183725179420


----------------------------------------
Feature #9667: Optimization of __FILE__ and __dir__
https://bugs.ruby-lang.org/issues/9667#change-45914

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
In the same spirit as the string literal followed by `freeze` is optimized, I think `__FILE__` and `__dir__` should be optimized. Currently, they return different object id each time they are called.

    __FILE__.object_id # => 70183725179420
    __FILE__.object_id # => 70183725129020
    ...

I propose them to be optimized so that they are only created once per occurrence.

    __FILE__.object_id # => 70183725179420
    __FILE__.object_id # => 70183725179420
    ...



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next