Wordpress - Speed of reading a json file vs having it hardcoded in the same file?

I need to run the following

acf_add_local_field_group($array)

about 15 times, with the total amount of lines in the array passed in, from all calls, adding up to about 7500 lines. I am wondering what the difference in speed would be between the two following scenarios:

  1. The arrays are hardcoded in the same file
  2. Every top level array is put into a json file in a directory called acf-json .

The second method is preferable to me, but I am worried about the performance cost of having to read the contents of 15 different files that total 7500 lines. This will run every time for wordpress (it is called in functions.php), so I don't want to incur a performance hit.

I could cache the files, but the cache would need to be flushed any time new code is pushed from github, so I'm not sure how that could be done, especially since we can't use any 3rd party caching plugins

Solutions

Why you don't use PHP arrays instead of Json files?, in that way you don't have to open the file but require it and do what ever you want.

Similar questions

WordPress $wpdb->get_row() Query Won't Work With Variable, But Works With Hardcoded
My code is correct (I've been programming for 13 years), but for some reason when I use a variable in a SELECT query in the WHERE clause, I get no result. If I hardcode it, it works. How could this be? Blowing my mind... Thanks!
My WordPress don't display the images that I've hardcoded
I'm coding a site in WordPress and I'd like to have a bookmark star shown before a course name. The thing is that the code works fine, I can see that it translates to the right place where the image is, but the image appears to not be found. Is there any configuration I need to do to make this image to show or anything I'm doing wrong? Code: Result...
How to transform hardcoded strings to polylang suitable translatable stings in WordPress private theme?
I'm using "Polylang" plugin for multilingual site. So, there is some points not suitable for translating strings. Some of theme I could change for become suitable. However, for some others, I couldn't. Here is the codes below. template-contacts.php Original code I've changes code as This works for regarding part. However, there is send message and ...
Update Wordpress database, change post_content hardcoded URLs
I am not a huge expert in MYSQL nor Regex (I guess I need to use some here), I would appreciate any help. So my problem is that I would like to change some hardcoded URLs in Wordpress post contents to different ones. Here is an example of a URL: http://cdn1.domain.com/wp-content/uploads/2017/05/16211742/Screenshot_051117_101304_AM.jpg Now, 'cdn1' c...
Replace hardcoded JavaScript String in WordPress Plugin
I'd like to replace the string "Submitting" (see below) without changing the source code of the plugin. I'm planning to replace it with a new script. What would be your code approach? Thanks for your help!
How to remove hardcoded domain name from WordPress links?
Wordpress loads all assets and links with an absolute URL including the domain name (e.g. <img src="https://example.com/cat.png">). How to NOT include the domain name? I tried editing the WP_CONTENT_URL and updating WP_SITEURL/WP_HOME with no success. Is there a simple way of doing that?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy .