While running wordpress site, save Ram usage is always great idea and you can easily improve the site performance by simple wordpress theme tricks.
We mostly use the get_permalink(), get_the_title() methods in our wordpress theme. Do not pass the post ID as parameter.
if you’re doing a get_permalink or get_title() call with Post id, 8 out of 10 times you’ll need to more of that post than just the permalink, so this isn’t really a problem.
save Ram usage
Post object is actually already slightly faster than calling get_permalink with $post->ID (in get_post it then only sanitizes and adds to cache, it doesn’t fetch new data), but the real benefit comes when you add a variable called filter in the $post object, setting it to “sample”. Now you decide whether that post object is going to be cached or not and which variables it contains.
Pass the $Post object instead of Post ID.
Do not use the Custom fields. Your server need to fire extra custom quries on Mysql server.
If your are using $wpdb->get_results or new WP_Query( $args ) then add the order by.
How can we save Ram usages using some wordpress theme tricks