Skip to content
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

perf: use the partial hash from textureLocation for caching #642

Merged
merged 5 commits into from
Oct 29, 2024

Conversation

SlayerOrnstein
Copy link
Member

@SlayerOrnstein SlayerOrnstein commented Oct 20, 2024

What did you fix?

Looks like DE embeds the hash as part of the texture location. So instead of having to download and generate the has based on data we can instead extract the hash from the imageStub and store that instead

/Lotus/Interface/Graphics/Helminth/ArchonShards/ArchonShardOrangeMythicGlow.png!00_qqsOE83Qt98Lr0gWQsLP4w
/Lotus/Interface/Graphics/Helminth/ArchonShards/ArchonShardOrange.png!00_lWAkmEzcuFYOy5Oknpy4AQ
/Lotus/Interface/Graphics/Helminth/ArchonShards/ArchonShardAmar.png!00_rSQSghtWz+j0RYah4EmfVg
/Lotus/Interface/Graphics/Helminth/ArchonShards/ArchonShardAmarMythicGlow.png!00_PRyBTogo3mZHDWxAUViI8Q
/Lotus/Interface/Graphics/Helminth/ArchonShards/ArchonShardVioletMythicGlow.png!00_gvq1+AcbRaF-UU8+uskvyQ

Reproduction steps


Evidence/screenshot/link to line

Considerations

  • Does this contain a new dependency? No
  • Does this introduce opinionated data formatting or manual data entry? Yes
  • Does this pr include updated data files in a separate commit that can be reverted for a clean code-only pr? Yes
  • Have I run the linter? Yes
  • Is is a bug fix, feature request, or enhancement? Enhancement

Summary by CodeRabbit

  • New Features
    • Enhanced image handling logic for more robust updates and caching.
    • Updated the missingWikiThumb list with new entries for improved content accuracy.
  • Bug Fixes
    • Streamlined cache update process for images.

Copy link

coderabbitai bot commented Oct 20, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request involve updates to the Build class in the build/build.mjs file, specifically enhancing the image handling logic in the saveImage method. A new variable, imageHash, is introduced to derive a hash from the imageStub, affecting how the hash variable is assigned. The updateCache method has been simplified by removing the hash comparison, directly utilizing the hash variable for cache updates. The data/warnings.json file has been updated to expand the missingWikiThumb array with new entries.

Changes

File Change Summary
build/build.mjs Modified saveImage method to include imageHash for hash assignment; simplified updateCache method by removing hash comparison.
data/warnings.json Expanded missingWikiThumb array with several new entries; other arrays remain unchanged.

Possibly related PRs

Suggested reviewers

  • EricSihaoLin
  • TobiTenno

Poem

In the meadow where images play,
A hash was born to light the way.
With stubs and caches, swift and bright,
The Build class dances in delight.
Hooray for changes, let’s all cheer,
For better images, we hold dear! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (1)
build/build.mjs (1)

228-228: Simplify the regular expression for extracting imageHash

The regular expression /!00_([\w\d\S]+)/ can be simplified. Since \w includes all word characters (letters, digits, and underscores), and \S matches any non-whitespace character, combining them is redundant. Consider updating the regex for clarity and efficiency.

Apply this diff to simplify the regular expression:

-const imageHash = imageStub.match(/!00_([\w\d\S]+)/);
+const imageHash = imageStub.match(/!00_([\S]+)/);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5edca7a and 3657e60.

⛔ Files ignored due to path filters (9)
  • data/img/antiserum-injector-fragment-a2cbfde4c7.png is excluded by !**/*.png
  • data/img/bonewidow-capsule.png is excluded by !**/*.png
  • data/img/bonewidow-casing.png is excluded by !**/*.png
  • data/img/bonewidow-engine.png is excluded by !**/*.png
  • data/img/bonewidow-weapon-pod.png is excluded by !**/*.png
  • data/img/javlok-capacitor-07b498f28c.png is excluded by !**/*.png
  • data/img/mandachord-body-c7d292225d.png is excluded by !**/*.png
  • data/img/mandachord-bridge-4343910df2.png is excluded by !**/*.png
  • data/img/mandachord-fret-5f0f4b85af.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • build/build.mjs (2 hunks)
🧰 Additional context used
🔇 Additional comments (1)
build/build.mjs (1)

259-259: Simplified cache update logic enhances code readability

Using the hash variable directly in this.updateCache simplifies the code and improves readability without altering functionality. This change aligns with the streamlined handling of hashes introduced in this update.

build/build.mjs Outdated Show resolved Hide resolved
@SlayerOrnstein SlayerOrnstein added the Scope: Scraper Specifically with how/what scraping occurs label Oct 20, 2024
Copy link
Member

@TobiTenno TobiTenno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, feel free to generate the images into the PR so it doesn't have to regen the cache on merge?

@SlayerOrnstein SlayerOrnstein enabled auto-merge (squash) October 29, 2024 13:32
@SlayerOrnstein SlayerOrnstein merged commit 2e78a27 into WFCD:master Oct 29, 2024
9 of 10 checks passed
@SlayerOrnstein SlayerOrnstein deleted the perf-image-cache branch October 29, 2024 13:46
@wfcd-bot-boi
Copy link
Collaborator

🎉 This PR is included in version 1.1264.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Scope: Scraper Specifically with how/what scraping occurs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants