PSCustomObject vs Hashtables
summary
Benchmarks show you choose by shape and behavior: hash tables are for performance — converting 10k records into a hashtable by email cuts matching time from minutes with Where‑Object down to tens of milliseconds; PSCustomObject is for display — nicer table/formatter output and pipeline friendliness. Use the type accelerator when creating many objects (about 0.1s vs ~3s for New‑Object), prefer .Contains over ContainsKey or -contains in cross‑dictionary code, and remember don't modify while iterating* (removing keys mid‑enumeration throws).
AI-written summary · about
chapters (9)
- 0:00Introduction
- 3:12PS Custom Objects vs Hash Tables
- 5:20Hash Tables creation
- 14:49Updating Hash Tables
- 20:54PS Custom Objects
- 24:47Formatting Hash Tables
- 33:03Iterating Hash Tables & Objects
- 38:43Performance comparison
- 45:04Q&A
related talks
46mPSCustomObject[] vs Hashtables: The ultimate object smackdown
47mPSCache: simple strategies for magnificent performance
31mThe Incredible Extensible PSObject
51mDon't do that, do this instead: PowerShell worst practices and..
42mMeasure Twice, Optimize Once: Real-World .NET Profiling with Visual Studio
44m99 Problems, but Slow PowerShell Ain't One!
01h 16mLevel Up Your PowerShell: Essential Tips, Tricks, and Techniques
40mParameter Classes: Making parameter-binding user friendly
