タグ

パフォーマンスに関するdorapon2000のブックマーク (2)

  • Speeding up the JavaScript ecosystem - The barrel file debacle

    Let's imagine you are working on a big project with many files. You add a new file to work on a new feature and import a function from another directory into your code. import { foo } from "./some/other-file"; export function myCoolCode() { // Pretend that this is super smart code :) const result = foo(); return result; } Excited about finishing your feature, you run the code and realize that it t

    Speeding up the JavaScript ecosystem - The barrel file debacle
    dorapon2000
    dorapon2000 2025/04/14
    “Barrel files are files that only export other files and contain no code themselves.”
  • MySQLでIn句に大量の要素を渡すとまずい理由

    概要 MySQLでIN句を使用する時はIN句に渡す要素数に注意する必要があるとよく先輩エンジニアの方から聞いていたのですが、実際に大量の要素を渡すと何がまずいのかはっきり分かっていなかったので調べてみました。 この記事で伝えたいこと MySQLでIn句に大量の要素を渡すとまずい理由 まずい状況を回避するために気をつけるべきポイント 先に結論 MySQLでIN句に大量の要素を渡すとインデックスを貼っていたカラムだとしてもフルスキャンが発生しスロークエリになる可能性があります。 フルスキャンが発生してしまう条件はテーブルに設定してあるインデックスの内容とrange_optimizer_max_mem_size の設定値に依存しており、MySQL8でデフォルトの設定値 & シンプルなテーブルであってもおおよそ数万件の要素数をIN句に渡すとフルスキャンが発生する可能性があると考えられます。 検証環

    MySQLでIn句に大量の要素を渡すとまずい理由
    dorapon2000
    dorapon2000 2024/12/12
    “MySQLでIN句に大量の要素を渡した場合消費されるメモリがrange_optimizer_max_mem_sizeを超えてしまうと、rangeアクセスが破棄されスロークエリになる可能性が高いです。”
  • 1