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

Performance about multiple calls to replace #1019

Closed
o0lwj0o opened this issue Mar 10, 2018 · 2 comments
Closed

Performance about multiple calls to replace #1019

o0lwj0o opened this issue Mar 10, 2018 · 2 comments

Comments

@o0lwj0o
Copy link

o0lwj0o commented Mar 10, 2018

Hi,
    I have found multiple calls to String.replace(.. , ..) about the same pattern in the project.
For example, in the file WhereHows/wherehows-frontend/app/utils/Search.java:

   ...
   if (tableNotInList != null && tableNotInList.size() > 0) {
    ...
          shouldValueList.add(Json.parse(mustNotQueryUnit.replace("$FIELD", "name").
              replace("$VALUE", table.toLowerCase().trim())));
    ...
    }
    if (fieldAnyList != null && fieldAnyList.size() > 0) {
    ...
          shouldValueList.add(Json.parse(hasChildValue.replace("$TYPE", "field").
              replace("$FIELD", "field_name").
              replace("$VALUE", field.toLowerCase().trim())));
    ...
    }
    if (fieldAllList != null && fieldAllList.size() > 0) {
     ...
          mustValueList.add(Json.parse(hasChildValue.replace("$TYPE", "field").
              replace("$FIELD", "field_name").
              replace("$VALUE", field.toLowerCase().trim())));
    ...
    }
   ...

    There are multiple calls to replace about "$FIELD", "$VALUE" and "$TYPE". If it was achieved like the following code, it will promote its performance and be able to reuse the pattern.

Pattern pattern = Pattern.compile(regex);
pattern.matcher(str).replaceAll(repl);
@alyiwang
Copy link
Contributor

That's a good suggestion. Thanks! @camelliazhang could you comment on this?

@keremsahin1
Copy link
Contributor

Dear issue owner,

Thanks for your interest in WhereHows. We have recently announced DataHub which is the rebranding of WhereHows. LinkedIn improved the architecture of WhereHows and rebranded WhereHows into DataHub and replaced its metadata infrastructure in this direction. DataHub is a more advanced and improved metadata management product compared to WhereHows.

Unfortunately, we have to stop supporting WhereHows to better focus on DataHub and offer more help to DataHub users. Therefore, we will drop all issues related to WhereHows and will not accept any contribution for it. Active development for DataHub has already started on datahub branch and will continue to live in there until it's finally merged to master and project is renamed to DataHub.

Please check the datahub branch to get familar with DataHub.

Best,
DataHub team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants