-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Docs] Fixed the incorrect elapsed calculation and inappropriate output format #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes reorganize import statements for clarity, improve timing precision by switching to Changes
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/examples/scraping_strategies_performance.py (1)
5-5
: Nit: Remove extra whitespace after comma
There's an extra space between the imported symbols. Consolidate to a single space for consistent styling.-from crawl4ai.content_scraping_strategy import WebScrapingStrategy, LXMLWebScrapingStrategy +from crawl4ai.content_scraping_strategy import WebScrapingStrategy, LXMLWebScrapingStrategy
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/examples/scraping_strategies_performance.py
(3 hunks)
🔇 Additional comments (3)
docs/examples/scraping_strategies_performance.py (3)
2-2
: Approve: Separatetime
import for clarity
Splittingimport time
into its own line improves readability and conforms to grouping standard library imports separately.
6-6
: Inserted blank line – no action needed.
120-120
: Approve: Added newline before "Turbo Output"
Prepending a newline improves readability by visually separating the turbo output section from prior logs.
@@ -95,7 +95,7 @@ def test_scraping(): | |||
|
|||
# Time the scraping | |||
print("\nStarting scrape...") | |||
start_time = time.time() | |||
start_time = time.perf_counter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use time.perf_counter()
in the decorator for consistency
The timing_decorator
still uses time.time()
, which is less precise and can be affected by system clock adjustments. To maintain consistency with the high-resolution timer used in test_scraping
, switch to time.perf_counter()
:
def wrapper(*args, **kwargs):
- start = time.time()
+ start = time.perf_counter()
result = func(*args, **kwargs)
- elapsed = time.time() - start
+ elapsed = time.perf_counter() - start
timing_stats.add(strategy_name, func.__name__, elapsed)
return result
Fix elpased and improper output format in docs scraping strategies performance
Before fix

After fix

Summary by CodeRabbit
Style
Documentation