タグ

JSONに関するYassLabのブックマーク (6)

  • Optimizing Ruby’s JSON, Part 4

    In the previous post, we established that as long as ruby/json wasn’t competitive on micro-benchmarks, public perception wouldn’t change. Since what made ruby/json appear so bad on micro-benchmarks was its setup cost, we had to find ways to reduce it further. Spot the Seven Differences So I decided to file this performance discrepancy as a bug, and investigate it as such and started profiling Step

    YassLab
    YassLab 2025/01/01
    "with all the above optimizations, we were now faster than Oj when reusing the JSON::State object, but still quite a bit slower when allocating it on every call ... So there was no way around it, I had to find how to automatically re-use that JSON::State object. Or how to not allocate it at all?"
  • Optimizing Ruby’s JSON, Part 3

    In the previous post, I covered how I reimplemented JSON::Generator::State#configure in Ruby and some other changes. Unfortunately, it didn’t go as well as I initially thought. Mistakes Were Made The default gems that ship with Ruby are automatically copied inside ruby/ruby’s repo. In short, there’s a bot aptly named matzbot, that replicates all the commits from the various ruby/* gems, inside rub

    YassLab
    YassLab 2025/01/01
    “In the next post, we’ll dive into how the setup cost was optimized further, and then at some point, we’ll have to start talking about optimizing the parser.”
  • Optimizing Ruby’s JSON, Part 2

    In the previous post, I covered my motivations for improving ruby/json’s performance, and detailed the first 4 notable optimizations applied to speed up JSON generation. If I was to cover every single optimization applied, at this rate I’d end up with a dozen parts, so I’ll try to only focus on the one that made a significant difference or used an interesting pattern. Reducing Setup Cost - Argumen

    YassLab
    YassLab 2025/01/01
    “At this rate, and based only on the number of commits I haven’t yet covered, I may need 5 or 6 more parts, but I hope I won’t have to disgress as much as the series progress, and not all commits may be worth talking about. Edit: Part three is here.”
  • Optimizing Ruby’s JSON, Part 1

    I was recently made maintainer of the json gem, and aside from fixing some old bugs, I focused quite a bit on its performance, so that it is now the fastest JSON parser and generator for Ruby on most benchmarks. Contrary to what one might think, there wasn’t any black magic or deep knowledge involved. Most of the performance patches I applied were fairly simple optimizations driven by profiling. A

    YassLab
    YassLab 2025/01/01
    “I have way more optimizations than these ones to talk about, but I feel like it’s already a pretty packed blog post. So I’ll stop here and work on some followup soon, hopefully I won’t lose my motivation to write :). / Edit: Looks like I didn’t, part two is here.”
  • 動画コンテンツ(Video)の構造化データをマークアップする方法

    動画コンテンツ(Video)の構造化データをマークアップする方法を紹介します。 動画コンテンツの構造化データをマークアップすると、Googleはその動画に関する情報をより正確に理解できるようになります。 Googleのマット・カッツは、YouTubeなどの動画配信サービスにアップロードした動画であっても、自分のサイトに埋め込む際には動画の構造化データをマークアップすることを推奨しています。構造化データをマークアップすることで、Googleがその動画コンテンツをより正確に理解することにつながるためです。 JSON-LDでマークアップする 動画コンテンツ(Video)をJSON-LDでマークアップする方法です。JSON-LDはページのどこに記述しても問題ありませんが、通常は<head>タグ内に記述します。 <script type="application/ld+json"> { "@cont

    動画コンテンツ(Video)の構造化データをマークアップする方法
    YassLab
    YassLab 2023/02/21
    “サイトに埋め込む際には動画の構造化データをマークアップすることを推奨しています。構造化データをマークアップすることで、Googleがその動画コンテンツをより正確に理解することにつながるためです。”
  • curl-to-ruby: Convert curl commands to ruby's net/http

    Instantly convert curl commands to Ruby's net/http Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into ruby (2.0+) code using net/http. Currently, it knows the following options: -d

    YassLab
    YassLab 2022/12/01
    "Ruby's net/http is notorious for not having the friendliest API, but it isn't all that bad. Ruby has great gems like faraday, but in libraries and small utilities it's better to kill your dependencies and use what the stdlib provides. This tool turns a curl command into Ruby code using net/http."
  • 1