ByteCount[expr]
Wolframシステム内部で式 expr を記憶するのに必要なバイト数を返す.
ByteCount
ByteCount[expr]
Wolframシステム内部で式 expr を記憶するのに必要なバイト数を返す.
例題
すべて開く すべて閉じる例 (2)
ByteCount[{1, 2, 3, 4, 5}]ByteCount[Range[10000]]異なるタイプの式のByteCountをプロットする:
DiscretePlot[ByteCount[Range[n]], {n, 100}]DiscretePlot[ByteCount[Integrate[1 / (1 + x ^ n), x]], {n, 30}]DiscretePlot[ByteCount[Sum[1 / (1 + x + x ^ n), x]], {n, 30}]アプリケーション (3)
Table[ByteCount[Integrate[1 / (x ^ n - 1), x]], {n, 10}]Simplifyが最小のByteCountの式を拾うようにする:
Simplify[50Log[10000], ComplexityFunction -> ByteCount]LeafCountは数の大きさを考慮しない:
Simplify[50Log[10000], ComplexityFunction -> LeafCount]記号的要素を含むリストは数字のリストよりもより大きいストレージを必要とすることを示す:
DiscretePlot[{ByteCount[Range[n]], ByteCount[ReplacePart[Range[n], x, 1]]}, {n, 20}]特性と関係 (8)
この例題に使われたコンピュータシステムでは,一般的な整数1つを保存するのに4バイト必要である:
ByteCount[Range[1000]]ByteCount[Range[1., 1000]]ByteCountは,実際に式を保存する際の共有は考慮しない:
x = 1000!;ByteCount[x]ByteCount[{x, x, x}]ByteCount[s]ASCII文字列については,各文字につきByteCountが平均1増加する:
Table[StringJoin[Table["x", {n}]], {n, 10}]ByteCount /@ %DiscretePlot[ByteCount[StringJoin[Table["x", {n}]]], {n, 100}]Unicode文字では,平均して各文字につき2バイト増加する:
Table[StringJoin[Table["α", {n}]], {n, 10}]ByteCount /@ %Table[FromDigits[Table[5, {n}]], {n, 15}]ByteCount /@ %DiscretePlot[ByteCount[FromDigits[Table[5, {n}]]], {n, 100}]増加の平均的な割合は,十進数字1つにつきおよそ0.4バイトである:
Fit[Table[ByteCount[FromDigits[Table[5, {n}]]], {n, 1000}], {1, n}, n]Table[Table[x, {n}], {n, 5}]ByteCount /@ %DiscretePlot[ByteCount[Table[x, {n}]], {n, 50}]MemoryConstrainedは指定のByteCountを超える式の生成を放棄する:
ByteCount[Range[10 ^ 6]]MemoryConstrained[Range[10 ^ 6], 10000]考えられる問題 (2)
ByteCount[Range[1., 1000]]厳密な0が存在するとデータがパックされるのを防ぐことができる:
ByteCount[Prepend[Range[1., 1000], 0]]ByteCountは,外部オブジェクトには処理の大きさしか与えない:
ByteCount[SelectedNotebook[]]テクニカルノート
-
▪
- メモリ管理
関連するガイド
-
▪
- メモリの計測と最適化 ▪
- 調整とデバッグ ▪
- 式の構造 ▪
- GPU計算 ▪
- NVIDIAを使ったGPU計算 ▪
- Appleを使ったGPU計算
関連するワークフロー
- ノートブックのサイズを求める
履歴
1988 で導入 (1.0)
テキスト
Wolfram Research (1988), ByteCount, Wolfram言語関数, https://reference.wolfram.com/language/ref/ByteCount.html.
CMS
Wolfram Language. 1988. "ByteCount." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ByteCount.html.
APA
Wolfram Language. (1988). ByteCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ByteCount.html
BibTeX
@misc{reference.wolfram_2026_bytecount, author="Wolfram Research", title="{ByteCount}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/ByteCount.html}", note=[Accessed: 10-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_bytecount, organization={Wolfram Research}, title={ByteCount}, year={1988}, url={https://reference.wolfram.com/language/ref/ByteCount.html}, note=[Accessed: 10-August-2026]}