انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهSRC-016-L08

عرض عملي: اختبار JMH كاذب ونسخته المصححة

  • الدرس 8 من 8
  • Senior C
في هذا الدرس 3 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

expose benchmark traps and fix them; prepares SRC-016-LAB1.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Show a benchmark claiming a new parser is 100 times faster.
  2. Inspect: the result is unused (dead-code elimination) and input is a constant.
  3. Planned mistake: run it once in a plain main method with a stopwatch. Fix: use JMH with forks, warm-up, and measurement iterations.
  4. Fix the benchmark: consume results through a Blackhole, use varied input from @State.
  5. Re-run: the true improvement is modest, with reported error bars.
  6. Add a note about what the microbenchmark does not show about the system.

اختبر فهمك

What suspicious sign did the first result show?

أظهر الإجابة

An implausibly large speedup, which suggested the work was optimized away.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.