{"id":15657327,"url":"https://github.com/macournoyer/fast_output_buffer","last_synced_at":"2025-10-16T05:58:47.670Z","repository":{"id":10441664,"uuid":"12608121","full_name":"macournoyer/fast_output_buffer","owner":"macournoyer","description":"A faster output buffer for ActionView.","archived":false,"fork":false,"pushed_at":"2013-09-05T17:51:05.000Z","size":144,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T06:13:38.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macournoyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-05T03:10:57.000Z","updated_at":"2022-02-06T10:22:09.000Z","dependencies_parsed_at":"2022-08-30T17:41:45.109Z","dependency_job_id":null,"html_url":"https://github.com/macournoyer/fast_output_buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Ffast_output_buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Ffast_output_buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Ffast_output_buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Ffast_output_buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macournoyer","download_url":"https://codeload.github.com/macournoyer/fast_output_buffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252524248,"owners_count":21762058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:06:21.169Z","updated_at":"2025-10-16T05:58:42.630Z","avatar_url":"https://github.com/macournoyer.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n## DO NOT USE\n\nAfter some more experimenting. This lib caused some critical issues with the capture helper and the like. Fixing this would revert most of the performance improvements.\n\nThat was a fun little experiment... But all is not lost. Check out https://github.com/brianmario/escape_utils to improve rendering perf like crazy in your apps :)\n\n---\n\n\n# FastOutputBuffer\n\nA faster output buffer for ActionView.\n\nRendering, rendering, rendering. That's all we're doing in our Rails apps! So why not make it as fast as possible?\n\nThe first time you render a view (template) in Rails, it will be compiled to a method. This is what a compiled view consisting of `\u003cp\u003e\u003c%= @title %\u003e\u003c/p\u003e` look like.\n\n    def _app_views_sites_index_html_erb___2525557208255998641_70225959709280(local_assigns, output_buffer)\n      # ...\n      @output_buffer = output_buffer || ActionView::OutputBuffer.new\n      @output_buffer.safe_append='\u003cp\u003e'\n      @output_buffer.append=( @title )\n      @output_buffer.safe_append='\u003c/p\u003e'\n      # ...\n    end\n\nYou see, all parts of your view are sent to a method of `ActionView::OutputBuffer`. `safe_append=` for chunks we know are safe and `append=` for stuff that is not and needs to be escaped. The more `\u003c% ... %\u003e` you have in your view, the more of those you'll have and the slower it will be.\n\nIf you have large views in your app, chances are most of the request time is spent rendering.\n\nDon't worry, `FastOutputBuffer` is here to save your day!\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'fast_output_buffer'\n\nAnd then execute:\n\n    $ bundle\n\nThat's it. `ActionView::OutputBuffer` will be replaced by FastOutputBuffer. Nothing to change in your code.\n\n## Warning: UTF-8 only\n\nFastOutputBuffer will not work with non-UTF-8. If you are dealing with other encodings do your best to transcode the string into a UTF-8 byte stream.\n\n    utf8_string = non_utf8_string.encode('UTF-8')\n\n## Benchmarks\n\nEarly artificial benchmarks indicate 20-30% increase in performance and several burned of wires.\n\n    $ ruby -Ilib bench.rb\n    ------------------------------------------------------------\n    100 tags, 100 characters in tags, rendered 500 times\n\n           user     system      total        real\n    FastSafeBuffer             1.190000   0.010000   1.200000 (  1.209613)\n    ActionView::OutputBuffer   1.470000   0.010000   1.480000 (  1.478364)\n    ------------------------------------------------------------\n    100 tags, 2500 characters in tags, rendered 500 times\n\n           user     system      total        real\n    FastSafeBuffer             1.910000   0.150000   2.060000 (  2.059526)\n    ActionView::OutputBuffer   3.110000   0.100000   3.210000 (  3.210287)\n    ------------------------------------------------------------\n    500 tags, 2500 characters in tags, rendered 500 times\n\n           user     system      total        real\n    FastSafeBuffer             9.440000   0.780000  10.220000 ( 10.232674)\n    ActionView::OutputBuffer  14.350000   0.650000  15.000000 ( 15.006372)\n    ------------------------------------------------------------\n    500 tags, 5000 characters in tags, rendered 500 times\n\n           user     system      total        real\n    FastSafeBuffer            14.060000   1.140000  15.200000 ( 15.193779)\n    ActionView::OutputBuffer  19.630000   0.850000  20.480000 ( 20.489630)\n    ------------------------------------------------------------\n    1000 tags, 1000 characters in tags, rendered 500 times\n\n           user     system      total        real\n    FastSafeBuffer            13.550000   0.730000  14.280000 ( 14.287905)\n    ActionView::OutputBuffer  17.310000   0.620000  17.930000 ( 17.932060)\n\n## Thanks\n\nBased on https://github.com/vmg/houdini \u003c3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacournoyer%2Ffast_output_buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacournoyer%2Ffast_output_buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacournoyer%2Ffast_output_buffer/lists"}