CARVIEW |
Select Language
HTTP/2 200
date: Tue, 29 Jul 2025 06:17:02 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"c868df5b38d0d269507cf83cc2940097"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=xEHYr0u8kMt%2BqCT2XIMr4dnmZscKW3AVBviVTDFzU%2FrILMP3ZZE%2FQAk7Kv3QZJ4NurVQ3A5UU3gAsmT%2FQvA5eRkVp%2B9StA6L2MCalG7o5O2VhIuvHOFLh3G025X9beyAF1rJHMk6U7lQ2JYIEu1nJnRwLCy%2FmoBBPA4q1%2F1b%2BP83JQolt36h4fJHekVE5%2BdQjfaQGIUaCX7XLMR8L174G01mcHHSqYX05EAV502P1FgSAyRzIpNqPeDgS%2BUyCB5omxbs0sbeTa%2FhUIUt8wFCBg%3D%3D--7cANp1HqD9dHJSJE--bUlrtFxwT4CC2BLtT2FMfg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.2041794627.1753769822; Path=/; Domain=github.com; Expires=Wed, 29 Jul 2026 06:17:02 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Wed, 29 Jul 2026 06:17:02 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: EB86:5844B:44E137:5A2B8B:6888675E
GitHub - methodmissing/promise: Lightweight Ruby MRI promise extension
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 0
Lightweight Ruby MRI promise extension
methodmissing/promise
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Lightweight Ruby MRI promise extension (c) 2010 Lourens Naudé (methodmissing), James Tucker (raggi), tmm1 && ice799 for pointers (pun intended) https://github.com/methodmissing/promise ** WORK IN PROGRESS ** This library works with Ruby 1.8 (1.9 pending) and is a more efficient implementation of the following Ruby code : class Promise def initialize(&blk) @thread = Thread.new(&blk) @result = nil end def method_missing(meth, *args) @result ||= @thread.value end end Examples : promise = Promise.new{ 1000.times{ IO.read(__FILE__) } } assert_equal 1000, promise.id # blocks only if we don't have a result from the computation thread yet Challenges : * Avoiding method_missing overhead, which bogs down even 1.9's BasicObject for this use case * rb_define_method(rb_cPromise, "__send__", rb_promise_result_argc_any, -1); * We attempt to negate some of that by overloading common Object members at compile time * Ideally one should overload rb_call (block the current thread) and thus a Promise implementation is best served as a MRI patch. Todo : * ruby 1.9 support * Fiber support * reduce further method call overhead * look into a symbol table for caching Performance : methodmissing:promise lourens$ rake bench (in /Users/lourens/projects/promise) /Users/lourens/.rvm/rubies/ruby-1.8.7-p249/bin/ruby bench/promise.rb Rehearsal -------------------------------------------------------------------- Promise 0.010000 0.000000 0.010000 ( 0.018255) RubyPromise 0.030000 0.000000 0.030000 ( 0.024190) Promise#== 0.010000 0.000000 0.010000 ( 0.017622) RubyPromise#== 0.020000 0.010000 0.030000 ( 0.020867) Promise#object_id 0.010000 0.000000 0.010000 ( 0.016699) RubyPromise#object_id 0.020000 0.000000 0.020000 ( 0.021970) Promise#__send__ 0.020000 0.000000 0.020000 ( 0.017142) RubyPromise#__send__ 0.020000 0.000000 0.020000 ( 0.021984) Promise (blocking) 0.040000 0.030000 0.070000 ( 0.072591) RubyPromise (blocking) 0.050000 0.030000 0.080000 ( 0.077348) Promise#== (blocking) 0.050000 0.030000 0.080000 ( 0.068011) RubyPromise#== (blocking) 0.050000 0.020000 0.070000 ( 0.084727) Promise#object_id (blocking) 0.050000 0.030000 0.080000 ( 0.069918) RubyPromise#object_id (blocking) 0.050000 0.030000 0.080000 ( 0.082319) Promise#__send__ (blocking) 0.040000 0.020000 0.060000 ( 0.071780) RubyPromise#__send__ (blocking) 0.060000 0.030000 0.090000 ( 0.088574) ----------------------------------------------------------- total: 0.760000sec user system total real Promise 0.010000 0.000000 0.010000 ( 0.014602) RubyPromise 0.020000 0.010000 0.030000 ( 0.022575) Promise#== 0.010000 0.000000 0.010000 ( 0.015162) RubyPromise#== 0.020000 0.000000 0.020000 ( 0.019323) Promise#object_id 0.010000 0.000000 0.010000 ( 0.015996) RubyPromise#object_id 0.010000 0.000000 0.010000 ( 0.019146) Promise#__send__ 0.010000 0.010000 0.020000 ( 0.015637) RubyPromise#__send__ 0.020000 0.000000 0.020000 ( 0.019562) Promise (blocking) 0.040000 0.020000 0.060000 ( 0.069022) RubyPromise (blocking) 0.050000 0.030000 0.080000 ( 0.080459) Promise#== (blocking) 0.050000 0.030000 0.080000 ( 0.068640) RubyPromise#== (blocking) 0.050000 0.020000 0.070000 ( 0.084409) Promise#object_id (blocking) 0.050000 0.030000 0.080000 ( 0.067952) RubyPromise#object_id (blocking) 0.060000 0.030000 0.090000 ( 0.085177) Promise#__send__ (blocking) 0.040000 0.020000 0.060000 ( 0.067793) RubyPromise#__send__ (blocking) 0.060000 0.030000 0.090000 ( 0.086539) To run the test suite: rake To run the benchmarks: rake bench
About
Lightweight Ruby MRI promise extension
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
You can’t perform that action at this time.