มีใครลองเอา burst trie/tst/etc มาลองใช้แทน hash ใน ruby runtime ดูบ้างเปล่า?

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.

มีใครลองเอา burst trie/tst/etc มาลองใช้แทน hash ใน ruby runtime ดูบ้างเปล่า?
เช่นเอามาใช้แทน st_lookup ใน rb_intern

อาจจะทำให้ ruby เร็วขึ้น + ใช้ mem น้อยลงมะ?

ขยายความหน่อยสิ
ไม่เคยรู้เรื่องนี้

veer's picture

ปกติเวลาทำ function call หรือ ส่ง message ใน Ruby กลไลข้างในต้องไปเรียก rb_intern ให้เปลี่ยนจากชื่อฟังก์ชันหรือชื่อ method ซึ่งเป็น string ให้เป็น id ก่อน

ใน rb_intern ใช้ hash table ในการ map จาก string ไป id จากที่คุยๆกับ lindever แล้วก็ไปอ่านต่อ ก็พบว่ามี data structure ที่อาจจะใช้ space และ/หรือ มีความเร็วกว่า hash table ในหลายๆ กรณี

ดังนั้นหากลองเปลี่ยน hash table ใน rb_intern เป็น data structure แบบอื่นก็น่าจะมีผลต่อ ความเร็ว และ memory ที่ ruby runtime ใช้

ย้าย Codenone

ประกาศย้าย Codenone ไปใช้ Forum ของ Blognone แทนครับ ตามไปตั้งกระทู้ต่อได้ที่ Codenone Forum (รายละเอียดอ่านจากกระทู้ ย้าย Codenone ไปรวมกับ Blognone)

กระทู้เก่าๆ จะย้ายตามไปในภายหลัง ตอนนี้ปิดการโพสต์กระทู้ไว้ เหลือไว้เฉพาะอ้างอิงเท่านั้น